aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-04-23 05:46:59 +0800
committerChris Lahey <clahey@src.gnome.org>2002-04-23 05:46:59 +0800
commitacf4bad9d022d9d4c69e7d05877194157f3fd31c (patch)
tree80714dfa3acf377d55744a8d09644f937b7b3edd /widgets/misc
parentfe26a0fee38b095d62a68783ea4d1b01b04e22db (diff)
downloadgsoc2013-evolution-acf4bad9d022d9d4c69e7d05877194157f3fd31c.tar.gz
gsoc2013-evolution-acf4bad9d022d9d4c69e7d05877194157f3fd31c.tar.zst
gsoc2013-evolution-acf4bad9d022d9d4c69e7d05877194157f3fd31c.zip
Bumped version number to 0.19.99.14.
2002-04-22 Christopher James Lahey <clahey@ximian.com> * configure.in: Bumped version number to 0.19.99.14. * gal/widgets/e-popup-menu.c, gal/widgets/e-popup-menu.h (e_popup_menu_copy_1, e_popup_menu_free_1, e_popup_menu_copy, e_popup_menu_free): Added these functions From gal/e-table/ChangeLog: 2002-04-22 Christopher James Lahey <clahey@ximian.com> * e-table-memory-store.c, e-table-memory-store.h: Renamed the insert functions in this class to make a bit more sense. From gal/menus/ChangeLog: 2002-04-22 Christopher James Lahey <clahey@ximian.com> * gal-view-instance.c, gal-view-instance.h (gal_view_instance_get_popup_menu, gal_view_instance_free_popup_menu): Added these functions. Used to add a current view menu to your popup menus. From gal/shortcut-bar/ChangeLog: 2002-04-22 Christopher James Lahey <clahey@ximian.com> * e-icon-bar.c (e_icon_bar_drag_motion): Removed an unused variable. svn path=/trunk/; revision=16559
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-popup-menu.c100
-rw-r--r--widgets/misc/e-popup-menu.h30
2 files changed, 105 insertions, 25 deletions
diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c
index 780ed55c76..86a07a74c8 100644
--- a/widgets/misc/e-popup-menu.c
+++ b/widgets/misc/e-popup-menu.c
@@ -106,21 +106,21 @@ e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_m
gboolean last_item_separator = TRUE;
int last_non_separator = -1;
int i;
-
+
for (i = 0; menu_list[i].name; i++) {
if (strcmp ("", menu_list[i].name) && !(menu_list [i].disable_mask & hide_mask)) {
last_non_separator = i;
}
}
-
+
for (i = 0; i <= last_non_separator; i++) {
gboolean separator;
-
+
separator = !strcmp ("", menu_list[i].name);
-
+
if ((!(separator && last_item_separator)) && !(menu_list [i].disable_mask & hide_mask)) {
GtkWidget *item = NULL;
-
+
if (!separator) {
if (menu_list[i].is_toggle)
item = gtk_check_menu_item_new ();
@@ -132,14 +132,14 @@ e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_m
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), menu_list[i].is_active);
if (menu_list[i].is_radio)
group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
-
+
make_item (menu, GTK_MENU_ITEM (item), L_(menu_list[i].name), menu_list[i].pixmap_widget);
} else {
item = gtk_menu_item_new ();
}
-
+
gtk_menu_append (menu, item);
-
+
if (!menu_list[i].submenu) {
if (menu_list[i].fn)
gtk_signal_connect (GTK_OBJECT (item), "activate",
@@ -148,22 +148,22 @@ e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_m
} else {
/* submenu */
GtkMenu *submenu;
-
+
submenu = e_popup_menu_create (menu_list[i].submenu, disable_mask, hide_mask,
default_closure);
-
+
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu));
}
-
+
if (menu_list[i].disable_mask & disable_mask)
gtk_widget_set_sensitive (item, FALSE);
-
+
gtk_widget_show (item);
-
+
last_item_separator = separator;
}
}
-
+
return menu;
}
@@ -180,3 +180,75 @@ e_popup_menu_run (EPopupMenu *menu_list, GdkEvent *event, guint32 disable_mask,
e_popup_menu (menu, event);
}
+void
+e_popup_menu_copy_1 (EPopupMenu *destination,
+ const EPopupMenu *source)
+{
+ destination->name = g_strdup (source->name);
+ destination->pixname = g_strdup (source->pixname);
+ destination->fn = source->fn;
+ destination->submenu = e_popup_menu_copy (source->submenu);
+ destination->disable_mask = source->disable_mask;
+
+ destination->pixmap_widget = source->pixmap_widget;
+ if (destination->pixmap_widget)
+ gtk_object_ref (GTK_OBJECT (destination->pixmap_widget));
+ destination->closure = source->closure;
+
+ destination->is_toggle = source->is_toggle;
+ destination->is_radio = source->is_radio;
+ destination->is_active = source->is_active;
+
+ destination->use_custom_closure = source->use_custom_closure;
+}
+
+void
+e_popup_menu_free_1 (EPopupMenu *menu_item)
+{
+ g_free (menu_item->name);
+ g_free (menu_item->pixname);
+ e_popup_menu_free (menu_item->submenu);
+
+ if (menu_item->pixmap_widget)
+ gtk_object_unref (GTK_OBJECT (menu_item->pixmap_widget));
+}
+
+EPopupMenu *
+e_popup_menu_copy (const EPopupMenu *menu_list)
+{
+ int i;
+ EPopupMenu *ret_val;
+
+ if (menu_list == NULL)
+ return NULL;
+
+ for (i = 0; menu_list[i].name; i++) {
+ /* Intentionally empty */
+ }
+
+ ret_val = g_new (EPopupMenu, i + 1);
+
+ for (i = 0; menu_list[i].name; i++) {
+ e_popup_menu_copy_1 (ret_val + i, menu_list + i);
+ }
+
+ /* Copy the terminator */
+ e_popup_menu_copy_1 (ret_val + i, menu_list + i);
+
+ return ret_val;
+}
+
+void
+e_popup_menu_free (EPopupMenu *menu_list)
+{
+ int i;
+
+ if (menu_list == NULL)
+ return;
+
+ for (i = 0; menu_list[i].name; i++) {
+ e_popup_menu_free_1 (menu_list + i);
+ }
+ g_free (menu_list);
+}
+
diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h
index 095c1a42d7..50fb7c23e5 100644
--- a/widgets/misc/e-popup-menu.h
+++ b/widgets/misc/e-popup-menu.h
@@ -74,7 +74,7 @@ typedef struct _EPopupMenu EPopupMenu;
struct _EPopupMenu {
char *name;
- const gchar *pixmap;
+ gchar *pixname;
void (*fn) (GtkWidget *widget, void *closure);
EPopupMenu *submenu;
guint32 disable_mask;
@@ -91,16 +91,24 @@ struct _EPopupMenu {
};
-GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
-
-void e_popup_menu_run (EPopupMenu *menu_list,
- GdkEvent *event,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
+GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
+ guint32 disable_mask,
+ guint32 hide_mask,
+ void *default_closure);
+void e_popup_menu_run (EPopupMenu *menu_list,
+ GdkEvent *event,
+ guint32 disable_mask,
+ guint32 hide_mask,
+ void *default_closure);
+
+/* Doesn't copy or free the memory. Just the contents. */
+void e_popup_menu_copy_1 (EPopupMenu *destination,
+ const EPopupMenu *menu_item);
+void e_popup_menu_free_1 (EPopupMenu *menu_item);
+
+/* Copies or frees the entire structure. */
+EPopupMenu *e_popup_menu_copy (const EPopupMenu *menu_item);
+void e_popup_menu_free (EPopupMenu *menu_item);
END_GNOME_DECLS