geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

notebook.c File Reference
#include "notebook.h"
#include "callbacks.h"
#include "documentprivate.h"
#include "geanyobject.h"
#include "keybindings.h"
#include "main.h"
#include "support.h"
#include "ui_utils.h"
#include "utils.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
Include dependency graph for notebook.c:

Go to the source code of this file.

Macros

#define GEANY_DND_NOTEBOOK_TAB_TYPE   "geany_dnd_notebook_tab"
 

Functions

static void notebook_page_reordered_cb (GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer user_data)
 
static void on_window_drag_data_received (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint target_type, guint event_time, gpointer user_data)
 
static void notebook_tab_close_clicked_cb (GtkButton *button, gpointer user_data)
 
static void setup_tab_dnd (void)
 
static void update_mru_docs_head (GeanyDocument *doc)
 
static void on_notebook_switch_page (GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data)
 
static void on_document_close (GObject *obj, GeanyDocument *doc)
 
static GtkWidget * ui_minimal_dialog_new (GtkWindow *parent, const gchar *title)
 
static gboolean is_modifier_key (guint keyval)
 
static gboolean on_key_release_event (GtkWidget *widget, GdkEventKey *ev, gpointer user_data)
 
static GtkWidget * create_switch_dialog (void)
 
static void update_filename_label (void)
 
static gboolean on_switch_timeout (G_GNUC_UNUSED gpointer data)
 
void notebook_switch_tablastused (void)
 
gboolean notebook_switch_in_progress (void)
 
static gboolean focus_sci (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gboolean gtk_notebook_show_arrows (GtkNotebook *notebook)
 
static gboolean is_position_on_tab_bar (GtkNotebook *notebook, GdkEventButton *event)
 
static void tab_bar_menu_activate_cb (GtkMenuItem *menuitem, gpointer data)
 
static void on_open_in_new_window_activate (GtkMenuItem *menuitem, gpointer user_data)
 
static gboolean has_tabs_on_right (GeanyDocument *doc)
 
static void on_close_documents_right_activate (GtkMenuItem *menuitem, GeanyDocument *doc)
 
static void show_tab_bar_popup_menu (GdkEventButton *event, GeanyDocument *doc)
 
static gboolean notebook_tab_bar_click_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
void notebook_init (void)
 
void notebook_free (void)
 
static void tab_count_changed (void)
 
static gboolean notebook_tab_click (GtkWidget *widget, GdkEventButton *event, gpointer data)
 
static void notebook_tab_close_button_style_set (GtkWidget *btn, GtkRcStyle *prev_style, gpointer data)
 
gint notebook_new_tab (GeanyDocument *this)
 
void notebook_remove_page (gint page_num)
 

Variables

static const GtkTargetEntry drag_targets []
 
static GtkTargetEntry files_drop_targets []
 
static const gsize MAX_MRU_DOCS = 20
 
static GQueue * mru_docs = NULL
 
static guint mru_pos = 0
 
static gboolean switch_in_progress = FALSE
 
static GtkWidget * switch_dialog = NULL
 
static GtkWidget * switch_dialog_label = NULL
 

Macro Definition Documentation

◆ GEANY_DND_NOTEBOOK_TAB_TYPE

#define GEANY_DND_NOTEBOOK_TAB_TYPE   "geany_dnd_notebook_tab"

Definition at line 44 of file notebook.c.

Function Documentation

◆ create_switch_dialog()

static GtkWidget * create_switch_dialog ( void  )
static

◆ focus_sci()

static gboolean focus_sci ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

Definition at line 304 of file notebook.c.

References document_get_current(), GeanyDocument::editor, NULL, and GeanyEditor::sci.

Referenced by notebook_new_tab().

◆ gtk_notebook_show_arrows()

static gboolean gtk_notebook_show_arrows ( GtkNotebook *  notebook)
static

Definition at line 315 of file notebook.c.

Referenced by is_position_on_tab_bar().

◆ has_tabs_on_right()

static gboolean has_tabs_on_right ( GeanyDocument doc)
static

◆ is_modifier_key()

static gboolean is_modifier_key ( guint  keyval)
static

Definition at line 146 of file notebook.c.

Referenced by on_key_release_event().

◆ is_position_on_tab_bar()

static gboolean is_position_on_tab_bar ( GtkNotebook *  notebook,
GdkEventButton *  event 
)
static

Definition at line 349 of file notebook.c.

References gtk_notebook_show_arrows(), and NULL.

Referenced by notebook_tab_bar_click_cb().

◆ notebook_free()

void notebook_free ( void  )

Definition at line 568 of file notebook.c.

References mru_docs.

Referenced by do_main_quit().

◆ notebook_init()

◆ notebook_new_tab()

◆ notebook_page_reordered_cb()

static void notebook_page_reordered_cb ( GtkNotebook *  notebook,
GtkWidget *  child,
guint  page_num,
gpointer  user_data 
)
static

Definition at line 583 of file notebook.c.

Referenced by setup_tab_dnd().

◆ notebook_remove_page()

◆ notebook_switch_in_progress()

gboolean notebook_switch_in_progress ( void  )

Definition at line 298 of file notebook.c.

References switch_in_progress.

Referenced by document_check_disk_status().

◆ notebook_switch_tablastused()

void notebook_switch_tablastused ( void  )

◆ notebook_tab_bar_click_cb()

static gboolean notebook_tab_bar_click_cb ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

Definition at line 515 of file notebook.c.

References document_new_file(), is_position_on_tab_bar(), NULL, and show_tab_bar_popup_menu().

Referenced by notebook_init().

◆ notebook_tab_click()

◆ notebook_tab_close_button_style_set()

static void notebook_tab_close_button_style_set ( GtkWidget *  btn,
GtkRcStyle *  prev_style,
gpointer  data 
)
static

Definition at line 653 of file notebook.c.

Referenced by notebook_new_tab().

◆ notebook_tab_close_clicked_cb()

static void notebook_tab_close_clicked_cb ( GtkButton *  button,
gpointer  user_data 
)
static

Definition at line 748 of file notebook.c.

References document_close.

Referenced by notebook_new_tab(), and show_tab_bar_popup_menu().

◆ on_close_documents_right_activate()

static void on_close_documents_right_activate ( GtkMenuItem *  menuitem,
GeanyDocument doc 
)
static

◆ on_document_close()

static void on_document_close ( GObject *  obj,
GeanyDocument doc 
)
static

Definition at line 113 of file notebook.c.

References main_status, main_widgets, mru_docs, and GeanyMainWidgets::notebook.

Referenced by notebook_init().

◆ on_key_release_event()

static gboolean on_key_release_event ( GtkWidget *  widget,
GdkEventKey *  ev,
gpointer  user_data 
)
static

◆ on_notebook_switch_page()

static void on_notebook_switch_page ( GtkNotebook *  notebook,
gpointer  page,
guint  page_num,
gpointer  user_data 
)
static

◆ on_open_in_new_window_activate()

static void on_open_in_new_window_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)
static

◆ on_switch_timeout()

static gboolean on_switch_timeout ( G_GNUC_UNUSED gpointer  data)
static

Definition at line 257 of file notebook.c.

References switch_dialog, switch_in_progress, and update_filename_label().

Referenced by notebook_switch_tablastused().

◆ on_window_drag_data_received()

static void on_window_drag_data_received ( GtkWidget *  widget,
GdkDragContext *  drag_context,
gint  x,
gint  y,
GtkSelectionData *  data,
guint  target_type,
guint  event_time,
gpointer  user_data 
)
static

Definition at line 788 of file notebook.c.

References document_open_file_list().

Referenced by notebook_init().

◆ setup_tab_dnd()

static void setup_tab_dnd ( void  )
static

Definition at line 574 of file notebook.c.

References main_widgets, GeanyMainWidgets::notebook, notebook_page_reordered_cb(), and NULL.

Referenced by notebook_init().

◆ show_tab_bar_popup_menu()

◆ tab_bar_menu_activate_cb()

static void tab_bar_menu_activate_cb ( GtkMenuItem *  menuitem,
gpointer  data 
)
static

Definition at line 407 of file notebook.c.

References DOC_VALID, and document_show_tab().

Referenced by show_tab_bar_popup_menu().

◆ tab_count_changed()

static void tab_count_changed ( void  )
static

◆ ui_minimal_dialog_new()

static GtkWidget * ui_minimal_dialog_new ( GtkWindow *  parent,
const gchar *  title 
)
static

Definition at line 126 of file notebook.c.

References dialog.

Referenced by create_switch_dialog().

◆ update_filename_label()

static void update_filename_label ( void  )
static

◆ update_mru_docs_head()

static void update_mru_docs_head ( GeanyDocument doc)
static

Definition at line 82 of file notebook.c.

References MAX_MRU_DOCS, and mru_docs.

Referenced by on_key_release_event(), and on_notebook_switch_page().

Variable Documentation

◆ drag_targets

const GtkTargetEntry drag_targets[]
static
Initial value:
=
{
{ "geany_dnd_notebook_tab" , GTK_TARGET_SAME_APP | GTK_TARGET_SAME_WIDGET, 0}
}

Definition at line 46 of file notebook.c.

Referenced by tab_count_changed().

◆ files_drop_targets

GtkTargetEntry files_drop_targets[]
static
Initial value:
= {
{ "STRING", 0, 0 },
{ "UTF8_STRING", 0, 0 },
{ "text/plain", 0, 0 },
{ "text/uri-list", 0, 0 }
}

Definition at line 51 of file notebook.c.

Referenced by tab_count_changed().

◆ MAX_MRU_DOCS

const gsize MAX_MRU_DOCS = 20
static

Definition at line 58 of file notebook.c.

Referenced by update_mru_docs_head().

◆ mru_docs

◆ mru_pos

guint mru_pos = 0
static

◆ switch_dialog

GtkWidget* switch_dialog = NULL
static

Definition at line 63 of file notebook.c.

Referenced by on_key_release_event(), on_switch_timeout(), and update_filename_label().

◆ switch_dialog_label

GtkWidget* switch_dialog_label = NULL
static

Definition at line 64 of file notebook.c.

Referenced by create_switch_dialog(), and update_filename_label().

◆ switch_in_progress

gboolean switch_in_progress = FALSE
static