From c0a255eb90769638d57ae4122932f75c46e4e531 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 11 Sep 2008 15:34:29 +0000 Subject: Merge revisions 36016:36303 from trunk. svn path=/branches/kill-bonobo/; revision=36307 --- widgets/menus/gal-view-instance.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'widgets/menus/gal-view-instance.c') diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index a99593ff4d..e31c7d1079 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -1,24 +1,24 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gal-view-instance.c - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: - * Chris Lahey * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Chris Lahey + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include -- cgit v1.2.3 From c7d3c9f95609123035ebaa267f9d2e6ecfa8c2e8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 12 Jan 2009 04:12:01 +0000 Subject: Merge revisions 36866:37046 from trunk. svn path=/branches/kill-bonobo/; revision=37050 --- widgets/menus/gal-view-instance.c | 1 - 1 file changed, 1 deletion(-) (limited to 'widgets/menus/gal-view-instance.c') diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index e31c7d1079..a1eac04b6c 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -31,7 +31,6 @@ #include #include -#include #include #include #include -- cgit v1.2.3 From bd9f473a896496b95b9896d30940f2ab27493432 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 23 Jan 2009 21:41:01 +0000 Subject: Redesign EPluginUI to accommodate merging and unmerging shell views. Get the "mark-all-read" and "plugin-manager" plugins working. svn path=/branches/kill-bonobo/; revision=37125 --- widgets/menus/gal-view-instance.c | 141 -------------------------------------- 1 file changed, 141 deletions(-) (limited to 'widgets/menus/gal-view-instance.c') diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index a1eac04b6c..19ec402fa3 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -46,10 +46,6 @@ G_DEFINE_TYPE (GalViewInstance, gal_view_instance, G_TYPE_OBJECT) -static const EPopupMenu separator = E_POPUP_SEPARATOR; -static const EPopupMenu terminator = E_POPUP_TERMINATOR; - - #define d(x) enum { @@ -467,140 +463,3 @@ gal_view_instance_exists (GalViewInstance *instance) return FALSE; } - -typedef struct { - GalViewInstance *instance; - char *id; -} ListenerClosure; - -static void -view_item_cb (GtkWidget *widget, - gpointer user_data) -{ - ListenerClosure *closure = user_data; - - if (GTK_CHECK_MENU_ITEM (widget)->active) { - gal_view_instance_set_current_view_id (closure->instance, closure->id); - } -} - -static void -add_popup_radio_item (EPopupMenu *menu_item, - gchar *title, - GCallback fn, - gpointer closure, - gboolean value) -{ - EPopupMenu menu_item_struct = - E_POPUP_RADIO_ITEM_CC (title, - fn, - closure, - 0, - 0); - menu_item_struct.is_active = value; - - e_popup_menu_copy_1 (menu_item, &menu_item_struct); -} - -static void -add_popup_menu_item (EPopupMenu *menu_item, - gchar *title, - GCallback fn, - gpointer closure) -{ - EPopupMenu menu_item_struct = - E_POPUP_ITEM_CC (title, - fn, - closure, - 0); - - e_popup_menu_copy_1 (menu_item, &menu_item_struct); -} - -static void -define_views_dialog_response(GtkWidget *dialog, int id, GalViewInstance *instance) -{ - if (id == GTK_RESPONSE_OK) { - gal_view_collection_save(instance->collection); - } - gtk_widget_destroy (dialog); -} - -static void -define_views_cb(GtkWidget *widget, - GalViewInstance *instance) -{ - GtkWidget *dialog = gal_define_views_dialog_new(instance->collection); - g_signal_connect(dialog, "response", - G_CALLBACK(define_views_dialog_response), instance); - gtk_widget_show(dialog); -} - -static void -save_current_view_cb(GtkWidget *widget, - GalViewInstance *instance) -{ - gal_view_instance_save_as (instance); -} - -EPopupMenu * -gal_view_instance_get_popup_menu (GalViewInstance *instance) -{ - EPopupMenu *ret_val; - int length; - int i; - gboolean found = FALSE; - char *id; - - length = gal_view_collection_get_count(instance->collection); - id = gal_view_instance_get_current_view_id (instance); - - ret_val = g_new (EPopupMenu, length + 6); - - for (i = 0; i < length; i++) { - gboolean value = FALSE; - GalViewCollectionItem *item = gal_view_collection_get_view_item(instance->collection, i); - ListenerClosure *closure; - - closure = g_new (ListenerClosure, 1); - closure->instance = instance; - closure->id = item->id; - g_object_ref (closure->instance); - - if (!found && id && !strcmp (id, item->id)) { - found = TRUE; - value = TRUE; - } - - add_popup_radio_item (ret_val + i, item->title, G_CALLBACK (view_item_cb), closure, value); - } - - if (!found) { - e_popup_menu_copy_1 (ret_val + i++, &separator); - - add_popup_radio_item (ret_val + i++, N_("Custom View"), NULL, NULL, TRUE); - add_popup_menu_item (ret_val + i++, N_("Save Custom View"), G_CALLBACK (save_current_view_cb), instance); - } - - e_popup_menu_copy_1 (ret_val + i++, &separator); - add_popup_menu_item (ret_val + i++, N_("Define Views..."), G_CALLBACK (define_views_cb), instance); - e_popup_menu_copy_1 (ret_val + i++, &terminator); - - if (id) - g_free (id); - - return ret_val; -} - -void -gal_view_instance_free_popup_menu (GalViewInstance *instance, EPopupMenu *menu) -{ - int i; - /* This depends on the first non-custom closure to be a separator or a terminator. */ - for (i = 0; menu[i].name && *(menu[i].name); i++) { - g_object_unref (((ListenerClosure *)(menu[i].closure))->instance); - g_free (menu[i].closure); - } - - e_popup_menu_free (menu); -} -- cgit v1.2.3 From f4cf9af33ccde3142a3011e8b2dbcfb4cbc9ae81 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 20 May 2009 16:50:00 +0200 Subject: Use -no-undefined on Linux too There still left two things opened, search for KILL-BONOBO to find them. One is in calendar's Makefile.am, one in composer. --- widgets/menus/gal-view-instance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'widgets/menus/gal-view-instance.c') diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index 19ec402fa3..40a9e5262a 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -38,7 +38,7 @@ #include #include "e-util/e-util.h" #include "e-util/e-xml-utils.h" -#include "misc/e-unicode.h" +#include "e-util/e-unicode.h" #include "gal-define-views-dialog.h" #include "gal-view-instance.h" -- cgit v1.2.3 From e4afd3f9fb962ea1295a0657ec9f83a427829171 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 May 2009 23:21:02 -0400 Subject: Remove trailing whitespace, again. --- widgets/menus/gal-view-instance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'widgets/menus/gal-view-instance.c') diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index 3b0e02c064..9e0e2eb7c9 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -11,7 +11,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see + * License along with the program; if not, see * * * Authors: -- cgit v1.2.3 From 948235c3d1076dbe6ed2e57a24c16a083bbd9f01 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 10:29:19 -0400 Subject: Prefer GLib basic types over C types. --- widgets/menus/gal-view-instance.c | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'widgets/menus/gal-view-instance.c') diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index 07dab81336..bd93b64034 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -83,14 +83,14 @@ save_current_view (GalViewInstance *instance) xmlDoc *doc; xmlNode *root; - doc = xmlNewDoc((const unsigned char *)"1.0"); - root = xmlNewNode (NULL, (const unsigned char *)"GalViewCurrentView"); + doc = xmlNewDoc((const guchar *)"1.0"); + root = xmlNewNode (NULL, (const guchar *)"GalViewCurrentView"); xmlDocSetRootElement(doc, root); if (instance->current_id) - e_xml_set_string_prop_by_name (root, (const unsigned char *)"current_view", instance->current_id); + e_xml_set_string_prop_by_name (root, (const guchar *)"current_view", instance->current_id); if (instance->current_type) - e_xml_set_string_prop_by_name (root, (const unsigned char *)"current_view_type", instance->current_type); + e_xml_set_string_prop_by_name (root, (const guchar *)"current_view_type", instance->current_type); if (e_xml_save_file (instance->current_view_filename, doc) == -1) g_warning ("Unable to save view to %s - %s", instance->current_view_filename, g_strerror(errno)); @@ -225,7 +225,7 @@ static void collection_changed (GalView *view, GalViewInstance *instance) { if (instance->current_id) { - char *view_id = instance->current_id; + gchar *view_id = instance->current_id; instance->current_id = NULL; gal_view_instance_set_current_view_id (instance, view_id); g_free (view_id); @@ -254,7 +254,7 @@ load_current_view (GalViewInstance *instance) instance->current_id = g_strdup (gal_view_instance_get_default_view (instance)); if (instance->current_id) { - int index = gal_view_collection_get_view_index_by_id (instance->collection, + gint index = gal_view_collection_get_view_index_by_id (instance->collection, instance->current_id); if (index != -1) { @@ -268,10 +268,10 @@ load_current_view (GalViewInstance *instance) } root = xmlDocGetRootElement(doc); - instance->current_id = e_xml_get_string_prop_by_name_with_default (root, (const unsigned char *)"current_view", NULL); + instance->current_id = e_xml_get_string_prop_by_name_with_default (root, (const guchar *)"current_view", NULL); if (instance->current_id != NULL) { - int index = gal_view_collection_get_view_index_by_id (instance->collection, + gint index = gal_view_collection_get_view_index_by_id (instance->collection, instance->current_id); if (index != -1) { @@ -281,8 +281,8 @@ load_current_view (GalViewInstance *instance) } } if (view == NULL) { - char *type; - type = e_xml_get_string_prop_by_name_with_default (root, (const unsigned char *)"current_view_type", NULL); + gchar *type; + type = e_xml_get_string_prop_by_name_with_default (root, (const guchar *)"current_view_type", NULL); view = gal_view_collection_load_view_from_file (instance->collection, type, instance->custom_filename); @@ -304,7 +304,7 @@ load_current_view (GalViewInstance *instance) * Return value: The new %GalViewInstance. **/ GalViewInstance * -gal_view_instance_new (GalViewCollection *collection, const char *instance_id) +gal_view_instance_new (GalViewCollection *collection, const gchar *instance_id) { GalViewInstance *instance = g_object_new (GAL_VIEW_INSTANCE_TYPE, NULL); if (gal_view_instance_construct (instance, collection, instance_id)) @@ -316,10 +316,10 @@ gal_view_instance_new (GalViewCollection *collection, const char *instance_id) } GalViewInstance * -gal_view_instance_construct (GalViewInstance *instance, GalViewCollection *collection, const char *instance_id) +gal_view_instance_construct (GalViewInstance *instance, GalViewCollection *collection, const gchar *instance_id) { - char *filename; - char *safe_id; + gchar *filename; + gchar *safe_id; g_return_val_if_fail (gal_view_collection_loaded (collection), NULL); @@ -352,7 +352,7 @@ gal_view_instance_construct (GalViewInstance *instance, GalViewCollection *colle } /* Manipulate the current view. */ -char * +gchar * gal_view_instance_get_current_view_id (GalViewInstance *instance) { if (instance->current_id && gal_view_collection_get_view_index_by_id (instance->collection, instance->current_id) != -1) @@ -362,10 +362,10 @@ gal_view_instance_get_current_view_id (GalViewInstance *instance) } void -gal_view_instance_set_current_view_id (GalViewInstance *instance, const char *view_id) +gal_view_instance_set_current_view_id (GalViewInstance *instance, const gchar *view_id) { GalView *view; - int index; + gint index; g_return_if_fail (instance != NULL); g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance)); @@ -408,7 +408,7 @@ gal_view_instance_set_custom_view (GalViewInstance *instance, GalView *view) } static void -dialog_response(GtkWidget *dialog, int id, GalViewInstance *instance) +dialog_response(GtkWidget *dialog, gint id, GalViewInstance *instance) { if (id == GTK_RESPONSE_OK) { gal_view_instance_save_as_dialog_save (GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (dialog)); @@ -436,7 +436,7 @@ gal_view_instance_load (GalViewInstance *instance) } /* These only mean anything before gal_view_instance_load is called the first time. */ -const char * +const gchar * gal_view_instance_get_default_view (GalViewInstance *instance) { if (instance->default_view) @@ -446,7 +446,7 @@ gal_view_instance_get_default_view (GalViewInstance *instance) } void -gal_view_instance_set_default_view (GalViewInstance *instance, const char *id) +gal_view_instance_set_default_view (GalViewInstance *instance, const gchar *id) { g_free (instance->default_view); instance->default_view = g_strdup (id); -- cgit v1.2.3