[geany/geany-plugins] cb2b7e: projectorganizer: Use stock icons instead of the ones provided by the plugin

Jiří Techet git-noreply at xxxxx
Fri Oct 13 17:37:28 UTC 2017


Branch:      refs/heads/icon_fix
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Fri, 13 Oct 2017 17:37:28 UTC
Commit:      cb2b7e13d1e9b2248348bdbbb82dc756ef9c8400
             https://github.com/geany/geany-plugins/commit/cb2b7e13d1e9b2248348bdbbb82dc756ef9c8400

Log Message:
-----------
projectorganizer: Use stock icons instead of the ones provided by the plugin

I used to ship toolbar icons with the plugin to be sure they are correct semantically.
For instance, the "+" icon is used to expand the tree and the semantics of the
corresponding icon in GTK is "add" - some crazy theme could for instance use
word "ADD" in the icon and then the icon wouldn't correspond to the "expand"
meaning.

However, I've just been playing with many icon themes on OS X and they display
these basic icon in more or less the same way so using stock icons seems to be
relatively safe. This also solves the problem of the shipped icon being displayed
in a different way than the rest of the system icons and in addition, if HiDPI icons
are available, they can be used on a highres monitor.


Modified Paths:
--------------
    build/projectorganizer.m4
    projectorganizer/Makefile.am
    projectorganizer/icons/Makefile.am
    projectorganizer/icons/prjorg-add-external.png
    projectorganizer/icons/prjorg-collapse.png
    projectorganizer/icons/prjorg-expand.png
    projectorganizer/icons/prjorg-file.png
    projectorganizer/icons/prjorg-follow.png
    projectorganizer/icons/prjorg-header.png
    projectorganizer/icons/prjorg-refresh.png
    projectorganizer/icons/prjorg-source.png
    projectorganizer/src/prjorg-sidebar.c

Modified: build/projectorganizer.m4
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -5,6 +5,5 @@ AC_DEFUN([GP_CHECK_PROJECTORGANIZER],
     AC_CONFIG_FILES([
         projectorganizer/Makefile
         projectorganizer/src/Makefile
-        projectorganizer/icons/Makefile
     ])
 ])


Modified: projectorganizer/Makefile.am
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1,4 +1,4 @@
 include $(top_srcdir)/build/vars.auxfiles.mk
 
-SUBDIRS = src icons
+SUBDIRS = src
 plugin = projectorganizer


Modified: projectorganizer/icons/Makefile.am
23 lines changed, 0 insertions(+), 23 deletions(-)
===================================================================
@@ -1,23 +0,0 @@
-icondir = $(datadir)/icons/hicolor/16x16/apps
-
-dist_icon_DATA = \
-	prjorg-file.png	\
-	prjorg-header.png	\
-	prjorg-source.png	\
-	prjorg-expand.png	\
-	prjorg-collapse.png	\
-	prjorg-follow.png	\
-	prjorg-add-external.png	\
-	prjorg-refresh.png
-
-gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
-install-data-hook: update-icon-cache
-uninstall-hook: update-icon-cache
-update-icon-cache:
-	@-if test -z "$(DESTDIR)"; then \
-		echo "Updating Gtk icon cache."; \
-		$(gtk_update_icon_cache); \
-	else \
-		echo "*** Icon cache not updated.  After (un)install, run this:"; \
-		echo "***   $(gtk_update_icon_cache)"; \
-	fi


Modified: projectorganizer/icons/prjorg-add-external.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/icons/prjorg-collapse.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/icons/prjorg-expand.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/icons/prjorg-file.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/icons/prjorg-follow.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/icons/prjorg-header.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/icons/prjorg-refresh.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/icons/prjorg-source.png
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online


Modified: projectorganizer/src/prjorg-sidebar.c
59 lines changed, 18 insertions(+), 41 deletions(-)
===================================================================
@@ -921,36 +921,13 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent,
 			g_free(content_type);
 		}
 
-		if (patterns_match(header_patterns, path_arr[level]))
-		{
-			if (! icon)
-				icon = g_icon_new_for_string("prjorg-header", NULL);
-
-			gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0,
-				FILEVIEW_COLUMN_ICON, icon,
-				FILEVIEW_COLUMN_NAME, path_arr[level],
-				FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1);
-		}
-		else if (patterns_match(source_patterns, path_arr[level]))
-		{
-			if (! icon)
-				icon = g_icon_new_for_string("prjorg-source", NULL);
+		if (! icon)
+			icon = g_themed_icon_new("text-x-generic");
 
-			gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0,
-				FILEVIEW_COLUMN_ICON, icon,
-				FILEVIEW_COLUMN_NAME, path_arr[level],
-				FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1);
-		}
-		else
-		{
-			if (! icon)
-				icon = g_icon_new_for_string("prjorg-file", NULL);
-
-			gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0,
-				FILEVIEW_COLUMN_ICON, icon,
-				FILEVIEW_COLUMN_NAME, path_arr[level],
-				FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1);
-		}
+		gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0,
+			FILEVIEW_COLUMN_ICON, icon,
+			FILEVIEW_COLUMN_NAME, path_arr[level],
+			FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1);
 
 		if (icon)
 			g_object_unref(icon);
@@ -962,7 +939,7 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent,
 		GtkTreeIter iter;
 		gchar **path_arr = dir_list->data;
 		gchar *last_dir_name;
-		GIcon *icon_dir = g_icon_new_for_string("folder", NULL);
+		GIcon *icon_dir = g_themed_icon_new("folder");
 
 		last_dir_name = path_arr[level];
 
@@ -1087,7 +1064,7 @@ static void load_project(void)
 	if (!prj_org || !geany_data->app->project)
 		return;
 
-	icon_dir = g_icon_new_for_string("folder", NULL);
+	icon_dir = g_themed_icon_new("folder");
 
 	header_patterns = get_precompiled_patterns(prj_org->header_patterns);
 	source_patterns = get_precompiled_patterns(prj_org->source_patterns);
@@ -1350,17 +1327,17 @@ void prjorg_sidebar_init(void)
 
 	g_signal_connect (s_toolbar, "realize", G_CALLBACK (sidebar_realized_cb), NULL);
 
-	item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL));
-	gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-refresh");
+	image = gtk_image_new_from_icon_name("view-refresh", GTK_ICON_SIZE_SMALL_TOOLBAR);
+	item = GTK_WIDGET(gtk_tool_button_new(image, NULL));
 	gtk_widget_set_tooltip_text(item, _("Reload all"));
 	g_signal_connect(item, "clicked", G_CALLBACK(on_reload_project), NULL);
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
 
 	item = GTK_WIDGET(gtk_separator_tool_item_new());
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
 
-	item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL));
-	gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-add-external");
+	image = gtk_image_new_from_icon_name("folder-new", GTK_ICON_SIZE_SMALL_TOOLBAR);
+	item = GTK_WIDGET(gtk_tool_button_new(image, NULL));
 	gtk_widget_set_tooltip_text(item, _("Add external directory"));
 	g_signal_connect(item, "clicked", G_CALLBACK(on_add_external), NULL);
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
@@ -1369,15 +1346,15 @@ void prjorg_sidebar_init(void)
 	item = GTK_WIDGET(gtk_separator_tool_item_new());
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
 
-	item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL));
-	gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-expand");
+	image = gtk_image_new_from_icon_name("list-add", GTK_ICON_SIZE_SMALL_TOOLBAR);
+	item = GTK_WIDGET(gtk_tool_button_new(image, NULL));
 	gtk_widget_set_tooltip_text(item, _("Expand all"));
 	g_signal_connect(item, "clicked", G_CALLBACK(on_expand_all), NULL);
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
 	s_project_toolbar.expand = item;
 
-	item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL));
-	gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-collapse");
+	image = gtk_image_new_from_icon_name("list-remove", GTK_ICON_SIZE_SMALL_TOOLBAR);
+	item = GTK_WIDGET(gtk_tool_button_new(image, NULL));
 	gtk_widget_set_tooltip_text(item, _("Collapse to project root"));
 	g_signal_connect(item, "clicked", G_CALLBACK(on_collapse_all), NULL);
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
@@ -1387,8 +1364,8 @@ void prjorg_sidebar_init(void)
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
 
 	item = GTK_WIDGET(gtk_toggle_tool_button_new());
+	gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "go-jump");
 	gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(item), TRUE);
-	gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-follow");
 	gtk_widget_set_tooltip_text(item, _("Follow active editor"));
 	g_signal_connect(item, "clicked", G_CALLBACK(on_follow_active), NULL);
 	gtk_container_add(GTK_CONTAINER(s_toolbar), item);
@@ -1442,7 +1419,7 @@ void prjorg_sidebar_init(void)
 
 	s_popup_menu.widget = gtk_menu_new();
 
-	image = gtk_image_new_from_icon_name("prjorg-expand", GTK_ICON_SIZE_MENU);
+	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);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list