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)  

toolbar.c File Reference
#include "toolbar.h"
#include "app.h"
#include "build.h"
#include "callbacks.h"
#include "document.h"
#include "geanyentryaction.h"
#include "geanymenubuttonaction.h"
#include "main.h"
#include "support.h"
#include "ui_utils.h"
#include "utils.h"
#include <string.h>
#include <glib/gstdio.h>
Include dependency graph for toolbar.c:

Go to the source code of this file.


struct  TBEditorWidget


#define TB_EDITOR_SEPARATOR   _("Separator")
#define TB_EDITOR_SEPARATOR_LABEL   _("--- Separator ---")




GtkWidget * toolbar_get_widget_by_name (const gchar *name)
GtkWidget * toolbar_get_widget_child_by_name (const gchar *name)
GtkAction * toolbar_get_action_by_name (const gchar *name)
static void toolbar_item_destroy_cb (GtkWidget *widget, G_GNUC_UNUSED gpointer data)
void toolbar_item_ref (GtkToolItem *item)
static GtkWidget * toolbar_reload (const gchar *markup)
static void toolbar_notify_style_cb (GObject *object, GParamSpec *arg1, gpointer data)
GtkWidget * toolbar_init (void)
void toolbar_update_ui (void)
gint toolbar_get_insert_position (void)
void toolbar_finalize (void)
void toolbar_show_hide (void)
static void toolbar_set_icon_style (void)
static void toolbar_set_icon_size (void)
void toolbar_apply_settings (void)
static void tb_editor_handler_start_element (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
static GSList * tb_editor_parse_ui (const gchar *buffer, gssize length, GError **error)
static void tb_editor_set_item_values (const gchar *name, GtkListStore *store, GtkTreeIter *iter)
static void tb_editor_scroll_to_iter (GtkTreeView *treeview, GtkTreeIter *iter)
static void tb_editor_free_path (TBEditorWidget *tbw)
static void tb_editor_btn_remove_clicked_cb (GtkWidget *button, TBEditorWidget *tbw)
static void tb_editor_btn_add_clicked_cb (GtkWidget *button, TBEditorWidget *tbw)
static gboolean tb_editor_drag_motion_cb (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, guint ltime, TBEditorWidget *tbw)
static void tb_editor_drag_data_get_cb (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint ltime, TBEditorWidget *tbw)
static void tb_editor_drag_data_rcvd_cb (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint ltime, TBEditorWidget *tbw)
static gboolean tb_editor_foreach_used (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
static void tb_editor_write_markup (TBEditorWidget *tbw)
static void tb_editor_available_items_changed_cb (GtkTreeModel *model, GtkTreePath *arg1, GtkTreeIter *arg2, TBEditorWidget *tbw)
static void tb_editor_available_items_deleted_cb (GtkTreeModel *model, GtkTreePath *arg1, TBEditorWidget *tbw)
static TBEditorWidgettb_editor_create_dialog (GtkWindow *parent)
void toolbar_configure (GtkWindow *parent)


GeanyToolbarPrefs toolbar_prefs
static GtkUIManager * uim
static GtkActionGroup * group
static GSList * plugin_items = NULL
static const GtkActionEntry ui_entries []
static const guint ui_entries_n = G_N_ELEMENTS(ui_entries)
static const gchar * toolbar_markup
static const GtkTargetEntry tb_editor_dnd_targets []
static const gint tb_editor_dnd_targets_len = G_N_ELEMENTS(tb_editor_dnd_targets)
static const GMarkupParser tb_editor_xml_parser

Macro Definition Documentation


#define TB_EDITOR_SEPARATOR   _("Separator")

Definition at line 584 of file toolbar.c.


#define TB_EDITOR_SEPARATOR_LABEL   _("--- Separator ---")

Definition at line 585 of file toolbar.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 608 of file toolbar.c.

Function Documentation

◆ tb_editor_available_items_changed_cb()

static void tb_editor_available_items_changed_cb ( GtkTreeModel *  model,
GtkTreePath *  arg1,
GtkTreeIter *  arg2,
TBEditorWidget tbw 

Definition at line 916 of file toolbar.c.

References tb_editor_write_markup().

Referenced by toolbar_configure().

◆ tb_editor_available_items_deleted_cb()

static void tb_editor_available_items_deleted_cb ( GtkTreeModel *  model,
GtkTreePath *  arg1,
TBEditorWidget tbw 

Definition at line 923 of file toolbar.c.

References tb_editor_write_markup().

Referenced by toolbar_configure().

◆ tb_editor_btn_add_clicked_cb()

◆ tb_editor_btn_remove_clicked_cb()

◆ tb_editor_create_dialog()

◆ tb_editor_drag_data_get_cb()

static void tb_editor_drag_data_get_cb ( GtkWidget *  widget,
GdkDragContext *  context,
GtkSelectionData *  data,
guint  info,
guint  ltime,
TBEditorWidget tbw 

◆ tb_editor_drag_data_rcvd_cb()

static void tb_editor_drag_data_rcvd_cb ( GtkWidget *  widget,
GdkDragContext *  context,
gint  x,
gint  y,
GtkSelectionData *  data,
guint  info,
guint  ltime,
TBEditorWidget tbw 

◆ tb_editor_drag_motion_cb()

static gboolean tb_editor_drag_motion_cb ( GtkWidget *  widget,
GdkDragContext *  drag_context,
gint  x,
gint  y,
guint  ltime,
TBEditorWidget tbw 

Definition at line 771 of file toolbar.c.

References TBEditorWidget::last_drag_path, TBEditorWidget::last_drag_pos, and NULL.

Referenced by tb_editor_create_dialog().

◆ tb_editor_foreach_used()

static gboolean tb_editor_foreach_used ( GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data 

Definition at line 868 of file toolbar.c.

References EMPTY, TB_EDITOR_COL_ACTION, TB_EDITOR_SEPARATOR, and utils_str_equal().

Referenced by tb_editor_write_markup().

◆ tb_editor_free_path()

static void tb_editor_free_path ( TBEditorWidget tbw)

Definition at line 703 of file toolbar.c.

References TBEditorWidget::last_drag_path, and NULL.

Referenced by tb_editor_drag_data_rcvd_cb(), and toolbar_configure().

◆ tb_editor_handler_start_element()

static void tb_editor_handler_start_element ( GMarkupParseContext *  context,
const gchar *  element_name,
const gchar **  attribute_names,
const gchar **  attribute_values,
gpointer  data,
GError **  error 

Definition at line 616 of file toolbar.c.

References NULL, TB_EDITOR_SEPARATOR, and utils_str_equal().

◆ tb_editor_parse_ui()

static GSList * tb_editor_parse_ui ( const gchar *  buffer,
gssize  length,
GError **  error 

Definition at line 644 of file toolbar.c.

References error(), list, NULL, and tb_editor_xml_parser.

Referenced by toolbar_configure().

◆ tb_editor_scroll_to_iter()

static void tb_editor_scroll_to_iter ( GtkTreeView *  treeview,
GtkTreeIter *  iter 

◆ tb_editor_set_item_values()

static void tb_editor_set_item_values ( const gchar *  name,
GtkListStore *  store,
GtkTreeIter *  iter 

◆ tb_editor_write_markup()

◆ toolbar_apply_settings()

void toolbar_apply_settings ( void  )

◆ toolbar_configure()

◆ toolbar_finalize()

◆ toolbar_get_action_by_name()

GtkAction * toolbar_get_action_by_name ( const gchar *  name)

◆ toolbar_get_insert_position()

gint toolbar_get_insert_position ( void  )

◆ toolbar_get_widget_by_name()

GtkWidget * toolbar_get_widget_by_name ( const gchar *  name)

◆ toolbar_get_widget_child_by_name()

GtkWidget * toolbar_get_widget_child_by_name ( const gchar *  name)

◆ toolbar_init()

◆ toolbar_item_destroy_cb()

static void toolbar_item_destroy_cb ( GtkWidget *  widget,
G_GNUC_UNUSED gpointer  data 

Definition at line 160 of file toolbar.c.

References plugin_items.

Referenced by toolbar_item_ref().

◆ toolbar_item_ref()

void toolbar_item_ref ( GtkToolItem *  item)

Definition at line 166 of file toolbar.c.

References NULL, plugin_items, and toolbar_item_destroy_cb().

Referenced by plugin_add_toolbar_item().

◆ toolbar_notify_style_cb()

static void toolbar_notify_style_cb ( GObject *  object,
GParamSpec *  arg1,
gpointer  data 

◆ toolbar_reload()

◆ toolbar_set_icon_size()

static void toolbar_set_icon_size ( void  )

◆ toolbar_set_icon_style()

static void toolbar_set_icon_style ( void  )

◆ toolbar_show_hide()

◆ toolbar_update_ui()

Variable Documentation

◆ group

GtkActionGroup* group

◆ plugin_items

GSList* plugin_items = NULL

◆ tb_editor_dnd_targets

const GtkTargetEntry tb_editor_dnd_targets[]
Initial value:

Definition at line 602 of file toolbar.c.

Referenced by tb_editor_create_dialog(), and tb_editor_drag_data_get_cb().

◆ tb_editor_dnd_targets_len

const gint tb_editor_dnd_targets_len = G_N_ELEMENTS(tb_editor_dnd_targets)

Definition at line 606 of file toolbar.c.

Referenced by tb_editor_create_dialog().

◆ tb_editor_xml_parser

const GMarkupParser tb_editor_xml_parser
Initial value:
#define NULL
Definition: rbtree.h:150
static void tb_editor_handler_start_element(GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
Definition: toolbar.c:616

Definition at line 638 of file toolbar.c.

Referenced by tb_editor_parse_ui().

◆ toolbar_markup

const gchar* toolbar_markup
Initial value:
"<toolbar name='GeanyToolbar'>"
"<toolitem action='New'/>"
"<toolitem action='Open'/>"
"<toolitem action='Save'/>"
"<toolitem action='SaveAll'/>"
"<toolitem action='Reload'/>"
"<toolitem action='Close'/>"
"<toolitem action='NavBack'/>"
"<toolitem action='NavFor'/>"
"<toolitem action='Compile'/>"
"<toolitem action='Build'/>"
"<toolitem action='Run'/>"
"<toolitem action='Color'/>"
"<toolitem action='SearchEntry'/>"
"<toolitem action='Search'/>"
"<toolitem action='GotoEntry'/>"
"<toolitem action='Goto'/>"
"<toolitem action='Quit'/>"

Definition at line 89 of file toolbar.c.

Referenced by toolbar_reload().

◆ toolbar_prefs

◆ ui_entries

const GtkActionEntry ui_entries[]
Initial value:
= {
{ "Save", GTK_STOCK_SAVE, NULL, NULL, "Save the current file" , G_CALLBACK(on_save1_activate) },
{ "SaveAs", GTK_STOCK_SAVE_AS, NULL, NULL, "Save as" , G_CALLBACK(on_save_as1_activate) },
{ "SaveAll", "geany-save-all" , NULL, NULL, "Save all open files" , G_CALLBACK(on_save_all1_activate) },
{ "Reload", GTK_STOCK_REVERT_TO_SAVED, NULL, NULL, "Reload the current file from disk" , G_CALLBACK(on_toolbutton_reload_clicked) },
{ "Close", GTK_STOCK_CLOSE, NULL, NULL, "Close the current file" , G_CALLBACK(on_close1_activate) },
{ "CloseAll", "geany-close-all" , NULL, NULL, "Close all open files" , G_CALLBACK(on_close_all1_activate) },
{ "Cut", GTK_STOCK_CUT, NULL, NULL, "Cut the current selection" , G_CALLBACK(on_cut1_activate) },
{ "Copy", GTK_STOCK_COPY, NULL, NULL, "Copy the current selection" , G_CALLBACK(on_copy1_activate) },
{ "Paste", GTK_STOCK_PASTE, NULL, NULL, "Paste the contents of the clipboard" , G_CALLBACK(on_paste1_activate) },
{ "Delete", GTK_STOCK_DELETE, NULL, NULL, "Delete the current selection" , G_CALLBACK(on_delete1_activate) },
{ "Undo", GTK_STOCK_UNDO, NULL, NULL, "Undo the last modification" , G_CALLBACK(on_undo1_activate) },
{ "Redo", GTK_STOCK_REDO, NULL, NULL, "Redo the last modification" , G_CALLBACK(on_redo1_activate) },
{ "NavBack", GTK_STOCK_GO_BACK, NULL, NULL, "Navigate back a location" , G_CALLBACK(on_toolbutton_back_activate) },
{ "NavFor", GTK_STOCK_GO_FORWARD, NULL, NULL, "Navigate forward a location" , G_CALLBACK(on_toolbutton_forward_activate) },
{ "Compile", GTK_STOCK_CONVERT, "Compile" , NULL, "Compile the current file" , G_CALLBACK(on_toolbutton_compile_clicked) },
{ "Run", GTK_STOCK_EXECUTE, NULL, NULL, "Run or view the current file" , G_CALLBACK(on_toolbutton_run_clicked) },
{ "Color", GTK_STOCK_SELECT_COLOR, "Color Chooser" , NULL, "Open a color chooser dialog, to interactively pick colors from a palette" , G_CALLBACK(on_show_color_chooser1_activate) },
{ "ZoomIn", GTK_STOCK_ZOOM_IN, NULL, NULL, "Zoom in the text" , G_CALLBACK(on_zoom_in1_activate) },
{ "ZoomOut", GTK_STOCK_ZOOM_OUT, NULL, NULL, "Zoom out the text" , G_CALLBACK(on_zoom_out1_activate) },
{ "UnIndent", GTK_STOCK_UNINDENT, NULL, NULL, "Decrease indentation" , G_CALLBACK(on_menu_decrease_indent1_activate) },
{ "Indent", GTK_STOCK_INDENT, NULL, NULL, "Increase indentation" , G_CALLBACK(on_menu_increase_indent1_activate) },
{ "Search", GTK_STOCK_FIND, NULL, NULL, "Find the entered text in the current file" , G_CALLBACK(on_toolbutton_search_clicked) },
{ "Goto", GTK_STOCK_JUMP_TO, NULL, NULL, "Jump to the entered line number" , G_CALLBACK(on_toolbutton_goto_clicked) },
{ "Preferences", GTK_STOCK_PREFERENCES, NULL, NULL, "Show the preferences dialog" , G_CALLBACK(on_preferences1_activate) },
{ "Quit", GTK_STOCK_QUIT, NULL, NULL, "Quit Geany" , G_CALLBACK(on_quit1_activate) },
{ "Print", GTK_STOCK_PRINT, NULL, NULL, "Print document" , G_CALLBACK(on_print1_activate) },
{ "Replace", GTK_STOCK_FIND_AND_REPLACE, NULL, NULL, "Replace text in the current document" , G_CALLBACK(on_replace1_activate) }
void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:902
void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:125
void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:291
void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:1331
void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:273
void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:449
void on_toolbutton_forward_activate(GtkAction *menuitem, gpointer user_data)
Definition: callbacks.c:1600
void on_toolbutton_back_activate(GtkAction *menuitem, gpointer user_data)
Definition: callbacks.c:1606
void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data)
Definition: callbacks.c:1204
void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:848
void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:108
void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:211
void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:153
void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:256
void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:239
void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data)
Definition: callbacks.c:972
void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:460
void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:308
void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:225
void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:1340
void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:119
void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data)
Definition: callbacks.c:862
void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data)
Definition: callbacks.c:420
void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:168
void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data)
Definition: callbacks.c:329
void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:1219
void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: callbacks.c:159

Definition at line 55 of file toolbar.c.

Referenced by toolbar_init().

◆ ui_entries_n

const guint ui_entries_n = G_N_ELEMENTS(ui_entries)

Definition at line 85 of file toolbar.c.

Referenced by toolbar_init().

◆ uim

GtkUIManager* uim