Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Tue, 29 Oct 2019 18:30:06 UTC Commit: e2e854b6e10b2008ba1166d954502ac23e327b98 https://github.com/geany/geany-plugins/commit/e2e854b6e10b2008ba1166d954502a...
Log Message: ----------- projectorganizer: don't use stock icons
There is more choice when using icons based on freedesktop icon name so we can use better icons.
Modified Paths: -------------- projectorganizer/src/prjorg-menu.c projectorganizer/src/prjorg-sidebar.c projectorganizer/src/prjorg-utils.c projectorganizer/src/prjorg-utils.h
Modified: projectorganizer/src/prjorg-menu.c 18 lines changed, 3 insertions(+), 15 deletions(-) =================================================================== @@ -380,31 +380,19 @@ void prjorg_menu_init(void) gtk_widget_show(s_sep_item); gtk_container_add(GTK_CONTAINER(geany->main_widgets->project_menu), s_sep_item);
- image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - s_fif_item = gtk_image_menu_item_new_with_mnemonic(_("Find in Project Files...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(s_fif_item), image); - gtk_widget_show(s_fif_item); + s_fif_item = menu_item_new("edit-find", _("Find in Project Files...")); gtk_container_add(GTK_CONTAINER(geany->main_widgets->project_menu), s_fif_item); g_signal_connect((gpointer) s_fif_item, "activate", G_CALLBACK(on_find_in_project), NULL); keybindings_set_item(key_group, KB_FIND_IN_PROJECT, NULL, 0, 0, "find_in_project", _("Find in project files"), s_fif_item);
- image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - s_ff_item = gtk_image_menu_item_new_with_mnemonic(_("Find Project File...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(s_ff_item), image); - gtk_widget_show(s_ff_item); + s_ff_item = menu_item_new("edit-find", _("Find Project File...")); gtk_container_add(GTK_CONTAINER(geany->main_widgets->project_menu), s_ff_item); g_signal_connect((gpointer) s_ff_item, "activate", G_CALLBACK(on_find_file), NULL); keybindings_set_item(key_group, KB_FIND_FILE, NULL, 0, 0, "find_file", _("Find project file"), s_ff_item);
- image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - s_ft_item = gtk_image_menu_item_new_with_mnemonic(_("Find Project Symbol...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(s_ft_item), image); - gtk_widget_show(s_ft_item); + s_ft_item = menu_item_new("edit-find", _("Find Project Symbol...")); gtk_container_add(GTK_CONTAINER(geany->main_widgets->project_menu), s_ft_item); g_signal_connect((gpointer) s_ft_item, "activate", G_CALLBACK(on_find_tag), NULL); keybindings_set_item(key_group, KB_FIND_TAG, NULL,
Modified: projectorganizer/src/prjorg-sidebar.c 59 lines changed, 10 insertions(+), 49 deletions(-) =================================================================== @@ -1610,38 +1610,22 @@ void prjorg_sidebar_init(void)
s_popup_menu.widget = gtk_menu_new();
- image = gtk_image_new_from_icon_name("list-add", GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("Expand All")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("list-add", _("Expand All")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(expand_all), NULL); s_popup_menu.expand = item;
- image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("Find in Files...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("edit-find", _("Find in Files...")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_find_in_files), NULL); s_popup_menu.find_in_directory = item;
- image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("Find File...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("edit-find", _("Find File...")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_find_file), NULL); s_popup_menu.find_file = item;
- image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("Find Symbol...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("edit-find", _("Find Symbol...")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_find_tag), NULL); s_popup_menu.find_tag = item; @@ -1650,11 +1634,7 @@ void prjorg_sidebar_init(void) gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item);
- image = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("Remove External Directory")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("list-remove", _("Remove External Directory")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_remove_external_dir), NULL); s_popup_menu.remove_external_dir = item; @@ -1663,38 +1643,22 @@ void prjorg_sidebar_init(void) gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item);
- image = gtk_image_new_from_stock(GTK_STOCK_FILE, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("New File...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("document-new", _("New File...")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_create_file), NULL); s_popup_menu.create_file = item;
- image = gtk_image_new_from_stock(GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("New Directory...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("folder-new", _("New Directory...")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_create_dir), NULL); s_popup_menu.create_dir = item;
- image = gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("Rename...")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new(NULL, _("Rename...")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_rename), NULL); s_popup_menu.rename = item;
- image = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - item = gtk_image_menu_item_new_with_mnemonic(_("Delete")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); - gtk_widget_show(item); + item = menu_item_new("list-remove", _("Delete")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_delete), NULL); s_popup_menu.delete = item; @@ -1703,10 +1667,7 @@ void prjorg_sidebar_init(void) gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item);
- item = gtk_image_menu_item_new_with_mnemonic(_("H_ide Sidebar")); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), - gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU)); - gtk_widget_show(item); + item = menu_item_new("window-close", _("H_ide Sidebar")); gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item); g_signal_connect_swapped((gpointer) item, "activate", G_CALLBACK(keybindings_send_command),
Modified: projectorganizer/src/prjorg-utils.c 15 lines changed, 15 insertions(+), 0 deletions(-) =================================================================== @@ -226,3 +226,18 @@ gchar *get_project_base_path(void) } return NULL; } + + +GtkWidget *menu_item_new(const gchar *icon_name, const gchar *label) +{ + GtkWidget *item = gtk_image_menu_item_new_with_mnemonic(label); + + if (icon_name != NULL) + { + GtkWidget *image = gtk_image_new_from_icon_name(icon_name, GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); + gtk_widget_show(image); + } + gtk_widget_show(item); + return item; +}
Modified: projectorganizer/src/prjorg-utils.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -35,4 +35,6 @@ gboolean rename_file_or_dir(gchar *utf8_oldname, gchar *utf8_newname); gchar *get_selection(void); gchar *get_project_base_path(void);
+GtkWidget *menu_item_new(const gchar *icon_name, const gchar *label); + #endif
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).