aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-04-18 23:37:57 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-04-18 23:37:57 +0800
commitb997798e3573be6e4e8051807ca66a03756d4bec (patch)
tree6cd794eb8be3666bc114b9af02b2f163215607c3 /widgets
parent59b2f41e54f9f77b9e3f5e87e531ae15939b865f (diff)
downloadgsoc2013-evolution-b997798e3573be6e4e8051807ca66a03756d4bec.tar.gz
gsoc2013-evolution-b997798e3573be6e4e8051807ca66a03756d4bec.tar.zst
gsoc2013-evolution-b997798e3573be6e4e8051807ca66a03756d4bec.zip
handle toggle and radio items (make_item): the item is now passed in from
2002-04-18 JP Rosevear <jpr@ximian.com> * gal/widgets/e-popup-menu.c (e_popup_menu_create): handle toggle and radio items (make_item): the item is now passed in from above and not returned svn path=/trunk/; revision=16508
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-popup-menu.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c
index f735166883..780ed55c76 100644
--- a/widgets/misc/e-popup-menu.c
+++ b/widgets/misc/e-popup-menu.c
@@ -29,6 +29,8 @@
#include <gtk/gtkaccellabel.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkcheckmenuitem.h>
+#include <gtk/gtkradiomenuitem.h>
#include <gtk/gtksignal.h>
#include <libgnomeui/gtkpixmapmenuitem.h>
#include <libgnomeui/gnome-stock.h>
@@ -65,15 +67,12 @@ gnome_app_helper_gettext (const gchar *str)
/*
* Creates an item with an optional icon
*/
-static GtkWidget *
-make_item (GtkMenu *menu, const char *name, GtkWidget *pixmap)
+static void
+make_item (GtkMenu *menu, GtkMenuItem *item, const char *name, GtkWidget *pixmap)
{
- GtkWidget *label, *item;
+ GtkWidget *label;
guint label_accel;
-
- if (*name == '\0')
- return gtk_menu_item_new ();
-
+
/*
* Ugh. This needs to go into Gtk+
*/
@@ -82,30 +81,28 @@ make_item (GtkMenu *menu, const char *name, GtkWidget *pixmap)
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
- item = pixmap ? gtk_pixmap_menu_item_new () : gtk_menu_item_new ();
gtk_container_add (GTK_CONTAINER (item), label);
if (label_accel != GDK_VoidSymbol){
gtk_widget_add_accelerator (
- item,
+ GTK_WIDGET (item),
"activate_item",
gtk_menu_ensure_uline_accel_group (GTK_MENU (menu)),
label_accel, 0,
GTK_ACCEL_LOCKED);
}
- if (pixmap){
+ if (pixmap && GTK_IS_PIXMAP_MENU_ITEM (item)){
gtk_widget_show (pixmap);
gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (item), pixmap);
}
-
- return item;
}
GtkMenu *
e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_mask, void *default_closure)
{
GtkMenu *menu = GTK_MENU (gtk_menu_new ());
+ GSList *group = NULL;
gboolean last_item_separator = TRUE;
int last_non_separator = -1;
int i;
@@ -122,12 +119,24 @@ e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_m
separator = !strcmp ("", menu_list[i].name);
if ((!(separator && last_item_separator)) && !(menu_list [i].disable_mask & hide_mask)) {
- GtkWidget *item;
+ GtkWidget *item = NULL;
- if (!separator)
- item = make_item (menu, L_(menu_list[i].name), menu_list[i].pixmap_widget);
- else
- item = make_item (menu, "", NULL);
+ if (!separator) {
+ if (menu_list[i].is_toggle)
+ item = gtk_check_menu_item_new ();
+ else if (menu_list[i].is_radio)
+ item = gtk_radio_menu_item_new (group);
+ else
+ item = menu_list[i].pixmap_widget ? gtk_pixmap_menu_item_new () : gtk_menu_item_new ();
+ if (menu_list[i].is_toggle || menu_list[i].is_radio)
+ 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);
='insertions'>+19 * New Featuresdougb2010-02-081-18/+50 * - update to jpeg-8dinoex2010-02-056-5/+6 * - Update to 2.0.10pgollucci2010-02-043-13/+13 * - Fix dependswen2010-01-301-1/+3 * Add support for www/hiawatha for WebUI.itetcu2010-01-292-2/+16 * Catch up with master 1.634.linimon2010-01-281-30/+110 * Update for version 2.17dougb2010-01-241-1/+1 * - Remove unneeded dependencies which is in perl-5.8.9 distkuriyama2010-01-241-3/+1 * Update copyright datedougb2010-01-241-22/+32 * Update for version 2.17, add the --no-confirm optiondougb2010-01-241-1/+1 * Update the copyright datedougb2010-01-241-68/+227 * Update ports-mgmt/pkg_install to 20090902 snapshot.flz2010-01-232-5/+5 * Update to 3.4-20100104miwi2010-01-0636-1486/+232 * - remove superfluous EXTRACT_SUFXmich2010-01-041-1/+0 * - Update to 0.4wxs2010-01-023-7/+10 * Use BERLIOS macro for MASTER_SITES.bsam2010-01-011-1/+1 * Update for version 2.16dougb2009-12-311-1/+1 * Update for version 2.16:dougb2009-12-311-5/+5 * Two minor bug fixes:dougb2009-12-311-3/+9 * - Convert NOMANCOMPRESS to NO_MANCOMPRESS to sync with srcmiwi2009-12-291-1/+1 * - Restore some of the leftover exceptions but use LOCALBASE instead of X11BASE.miwi2009-12-282-6/+6 * - Expand the glob to check for Perl so that it actualltmiwi2009-12-272-1/+12 * - Update to 2.0.9miwi2009-12-273-200/+312 * - Remove X11BASE support it is now obsolete.miwi2009-12-265-0/+160 * - Add optional support for sysutils/lsofmiwi2009-12-261-2/+7 * App::Pm2Port is a perl module to creat FreeBSD port fromwen2009-12-225-0/+44 * - Update to a new snapshot: this fixes the bug in processing ports/packagesstas2009-12-222-4/+5 * - Update to 12/21/2009 snapshot.stas2009-12-222-4/+4 * Stop users from sending general questions, suggestions and patchesknu2009-12-212-2/+4 * For ports maintained by ports@FreeBSD.org, remove names and/ordougb2009-12-212-5/+0 * Update to 0.8.2makc2009-12-215-30/+38 * Update to 2.12.2.marcus2009-12-203-8/+15 * Update for version 2.15dougb2009-12-191-1/+1 * Update for version 2.15:dougb2009-12-191-3/+1 * This is svn version r200709dougb2009-12-191-72/+86 * - Get rip python 2.3+miwi2009-12-141-1/+1 * Update for version 2.14dougb2009-12-111-1/+1 * Bug Fixesdougb2009-12-111-37/+75 * 1. Show that -v can be used with --check-port-dbdirdougb2009-12-111-3/+5 * Update for version 2.13dougb2009-12-073-5/+8 * This is svn version r200201dougb2009-12-071-17/+152 * Introducing portmaster with package support!dougb2009-12-071-86/+510 * - Update HsColour to 1.15pgj2009-12-072-4/+4 * - Mark IGNORE, ports-mgmt/tinderbox is newermiwi2009-12-051-0/+2 * - Update to Tinderbox 3.3 Releasemiwi2009-12-055-30/+17 * - Update to latest development snapshot of portupgrade.stas2009-10-292-8/+9 * Forgot to bump version.remko2009-10-261-1/+1 * Fix unmatched quote.remko2009-10-211-1/+1 * - Add .bak to the list of files to be deleted in post-patch (the CHECK_FOR_ROOTwxs2009-09-191-1/+1 * - Add .bak to the list of files to be deleted in post-patch (the CHECK_FOR_ROOTwxs2009-09-191-3/+1 * - Add support for FreeBSD 9.0miwi2009-09-183-5/+25 * - Add support for FreeBSD 9.0miwi2009-09-173-0/+27 * Update for version 2.12dougb2009-09-153-2/+116 * Update for version 2.12:dougb2009-09-151-10/+18 * New Featuresdougb2009-09-151-96/+132 * portrac is a simple GUI tool for tracking port updates.miwi2009-09-134-0/+48 * Add 2 new patches being tested by flz@ in the next -exp run: uid/gidlinimon2009-09-131-10/+19 * - Update to 0.99sergei2009-09-104-115/+4 * Catch up with master 1.627. While here, include the latest version oflinimon2009-09-081-4/+101 * - Update GHC and Haskell ports to 6.10.4 (for both i386 and amd64), bumppgj2009-09-024-48/+132 * - Update to 0.15amdmi32009-09-022-4/+5 * - Update to 1.3.araujo2009-08-312-4/+4 * Catch up with master 1.626.linimon2009-08-291-36/+24 * Update for version 2.11dougb2009-08-251-1/+1 * 1. Add a "quick start" note to the top of the man page that directsdougb2009-08-251-6/+25 * In the previous update I did s/$globlist/$glob_dirs/ in multiport()dougb2009-08-251-2/+2 * - Switch SourceForge ports to the new File Release System: categories startin...amdmi32009-08-227-14/+7 * Update for version 2.10dougb2009-08-211-1/+1 * Bug Fixesdougb2009-08-211-19/+25 * Add dependency on KDE4 icons, which are in separate port now.makc2009-08-181-1/+3 * Change the default behaviour to continue on newly found leaf packages.stefan2009-08-132-3/+3 * - Update to 2.0.8 (code cleanup, new -a switch)amdmi32009-08-113-286/+369 * . fix pkg-plist;bsam2009-08-112-0/+2 * Update to version 2.2.bsam2009-08-102-4/+4 * Update for version 2.9dougb2009-08-071-1/+1 * In multiport() add a check_interactive() for every port in the listdougb2009-08-071-1/+3 * - Fix build after KDE updatemiwi2009-08-051-1/+1 * -Repocopy devel/libtool15 -> libtool22 and libltdl15 -> libltdl22.mezz2009-08-032-2/+2 * - bump all port that indirectly depends on libjpeg and have not yet been bump...dinoex2009-07-315-5/+5 * Update for version 2.8dougb2009-07-301-1/+1 * Update for version 2.8:dougb2009-07-301-16/+23 * Feature Updatesdougb2009-07-301-43/+58 * - Drop maintainership to ruby@sem2009-07-222-2/+2 * - A workaround for a null string problem with -R optionsem2009-07-222-1/+25 * Update to 2.12.1.marcus2009-07-192-8/+8 * Update to 2.12.0.marcus2009-07-093-12/+49 * symports reads through your ports tree and generates a tree usingtabthorpe2009-06-244-0/+37 * Download portaudit database from http://portaudit.FreeBSD.org/ insteadsimon2009-06-214-5/+5 * A simple utility to show the package name and versiondhn2009-06-185-0/+79 * Catch up with master 1.620.linimon2009-06-041-4/+6 * - Resolve LATEST_LINK conflictpav2009-06-011-0/+2 * Catch up with master 1.619.linimon2009-05-291-0/+21 * - Update to 1.2dhn2009-05-253-14/+10 * Update to 2.11.2.marcus2009-05-242-6/+34 * Chase libgmp and bump PORTREVISION.ale2009-05-132-2/+4 * Bring more fixes, optimizations and changes from CVS (PORTREVISION bumped):itetcu2009-05-1124-44/+1140 * Finds updates for FreeBSD pkgs by checking the ports index.miwi2009-05-015-0/+47 * - update to 1.2.1leeym2009-04-282-5/+6 * Update to 2.11.1.marcus2009-04-132-6/+20 * Import an other round of changes from marcuscom cvs and bump PORTREVISION:itetcu2009-04-1210-17/+257 * Catch up with master 1.617.linimon2009-04-111-9/+5 * - After portversion get -F option, -v stops showing full packages names.sem2009-04-092-1/+11