+2008-07-25 [colin] 3.5.0cvs34
+
+ * src/addrcustomattr.c
+ * src/addressbook.c
+ * src/compose.c
+ * src/editaddress.c
+ * src/editaddress_other_attributes_ldap.h
+ * src/edittags.c
+ * src/mainwindow.c
+ * src/mimeview.c
+ * src/prefs_actions.c
+ * src/prefs_filtering.c
+ * src/prefs_template.c
+ * src/summaryview.c
+ * src/textview.c
+ * src/textview.h
+ * src/toolbar.c
+ * src/gtk/about.c
+ * src/gtk/menu.c
+ * src/gtk/menu.h
+ * src/plugins/trayicon/trayicon.c
+ More changes from GtkItemFactory to GtkUIManager
+
2008-07-25 [colin] 3.5.0cvs33
* src/gtk/menu.h
( cvs diff -u -r 1.1.2.13 -r 1.1.2.14 src/plugins/pgpcore/pgp_viewer.c; cvs diff -u -r 1.1.2.51 -r 1.1.2.52 src/plugins/pgpcore/sgpgme.c; ) > 3.5.0cvs31.patchset
( cvs diff -u -r 1.274.2.255 -r 1.274.2.256 src/mainwindow.c; cvs diff -u -r 1.83.2.135 -r 1.83.2.136 src/mimeview.c; cvs diff -u -r 1.395.2.374 -r 1.395.2.375 src/summaryview.c; cvs diff -u -r 1.68.2.47 -r 1.68.2.48 src/summaryview.h; ) > 3.5.0cvs32.patchset
( cvs diff -u -r 1.4.2.13 -r 1.4.2.14 src/gtk/menu.h; ) > 3.5.0cvs33.patchset
+( cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/addrcustomattr.c; cvs diff -u -r 1.60.2.119 -r 1.60.2.120 src/addressbook.c; cvs diff -u -r 1.382.2.457 -r 1.382.2.458 src/compose.c; cvs diff -u -r 1.14.2.50 -r 1.14.2.51 src/editaddress.c; cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/editaddress_other_attributes_ldap.h; cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/edittags.c; cvs diff -u -r 1.274.2.256 -r 1.274.2.257 src/mainwindow.c; cvs diff -u -r 1.83.2.136 -r 1.83.2.137 src/mimeview.c; cvs diff -u -r 1.60.2.59 -r 1.60.2.60 src/prefs_actions.c; cvs diff -u -r 1.59.2.70 -r 1.59.2.71 src/prefs_filtering.c; cvs diff -u -r 1.12.2.64 -r 1.12.2.65 src/prefs_template.c; cvs diff -u -r 1.395.2.375 -r 1.395.2.376 src/summaryview.c; cvs diff -u -r 1.96.2.202 -r 1.96.2.203 src/textview.c; cvs diff -u -r 1.12.2.22 -r 1.12.2.23 src/textview.h; cvs diff -u -r 1.43.2.102 -r 1.43.2.103 src/toolbar.c; cvs diff -u -r 1.4.2.64 -r 1.4.2.65 src/gtk/about.c; cvs diff -u -r 1.5.2.29 -r 1.5.2.30 src/gtk/menu.c; cvs diff -u -r 1.4.2.14 -r 1.4.2.15 src/gtk/menu.h; cvs diff -u -r 1.14.2.64 -r 1.14.2.65 src/plugins/trayicon/trayicon.c; ) > 3.5.0cvs34.patchset
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=33
+EXTRA_VERSION=34
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
#include "addrbook.h"
#include "editaddress.h"
-static GtkItemFactory *custom_attr_popup_factory = NULL;
+static GtkActionGroup *custom_attr_popup_action = NULL;
static GtkWidget *custom_attr_popup_menu = NULL;
static struct CustomAttrWindow
}
}
-static void custom_attr_popup_clear_list (void *obj, guint action, void *data)
+static void custom_attr_popup_clear_list (void *obj, void *data)
{
custom_attr_window_list_view_clear_list(custom_attr_window.attr_list, TRUE);
}
-static void custom_attr_popup_delete (void *obj, guint action, void *data)
+static void custom_attr_popup_delete (void *obj, void *data)
{
GtkTreeIter sel;
GtkTreeModel *model;
}
}
-static void custom_attr_popup_factory_defaults (void *obj, guint action, void *data)
+static void custom_attr_popup_factory_defaults (void *obj, void *data)
{
if (alertpanel(_("Reset to default"),
_("Do you really want to replace all attribute names\nwith the default set?"),
}
}
-static GtkItemFactoryEntry custom_attr_popup_entries[] =
+static GtkActionEntry custom_attr_popup_entries[] =
{
- {N_("/_Delete"), NULL, custom_attr_popup_delete, 0, NULL, NULL},
- {N_("/Delete _all"), NULL, custom_attr_popup_clear_list, 0, NULL, NULL},
- {N_("/_Reset to default"), NULL, custom_attr_popup_factory_defaults, 0, NULL, NULL},
+ {"CustomAttrPopup", NULL, "CustomAttrPopup" },
+ {"CustomAttrPopup/Delete", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(custom_attr_popup_delete) },
+ {"CustomAttrPopup/DeleteAll", NULL, N_("Delete _all"), NULL, NULL, G_CALLBACK(custom_attr_popup_clear_list) },
+ {"CustomAttrPopup/Reset", NULL, N_("_Reset to default"), NULL, NULL, G_CALLBACK(custom_attr_popup_factory_defaults) },
};
static gint custom_attr_list_btn_pressed(GtkWidget *widget, GdkEventButton *event,
gboolean non_empty;
if (!custom_attr_popup_menu) {
- gint n_entries = sizeof(custom_attr_popup_entries) /
- sizeof(custom_attr_popup_entries[0]);
- custom_attr_popup_menu = menu_create_items(custom_attr_popup_entries,
- n_entries, "<CustomAttrPopupMenu>",
- &custom_attr_popup_factory, list_view);
+ custom_attr_popup_action = cm_menu_create_action_group("CustomAttrPopup", custom_attr_popup_entries,
+ G_N_ELEMENTS(custom_attr_popup_entries), (gpointer)list_view);
+ MENUITEM_ADDUI("/Menus", "CustomAttrPopup", "CustomAttrPopup", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus/CustomAttrPopup", "Delete", "CustomAttrPopup/Delete", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/CustomAttrPopup", "DeleteAll", "CustomAttrPopup/DeleteAll", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/CustomAttrPopup", "Reset", "CustomAttrPopup/Reset", GTK_UI_MANAGER_MENUITEM)
+ custom_attr_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/CustomAttrPopup")) );
}
/* grey out popup menu items if list is empty */
non_empty = gtk_tree_model_get_iter_first(model, &iter);
- menu_set_sensitive(custom_attr_popup_factory, "/Delete", non_empty);
- menu_set_sensitive(custom_attr_popup_factory, "/Delete all", non_empty);
+ cm_menu_set_sensitive("CustomAttrPopup/Delete", non_empty);
+ cm_menu_set_sensitive("CustomAttrPopup/DeleteAll", non_empty);
gtk_menu_popup(GTK_MENU(custom_attr_popup_menu),
NULL, NULL, NULL, NULL,
static void custom_attr_window_del_attr_cb(GtkWidget *widget,
gpointer data)
{
- custom_attr_popup_delete(NULL, 0, NULL);
+ custom_attr_popup_delete(NULL, NULL);
gtk_widget_grab_focus(custom_attr_window.attr_list);
}
if (event && event->keyval == GDK_Escape)
custom_attr_window_close();
else if (event && event->keyval == GDK_Delete)
- custom_attr_popup_delete(NULL, 0, NULL);
+ custom_attr_popup_delete(NULL, NULL);
return FALSE;
}
#include <glib.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkctree.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkitemfactory.h>
+#include <gtk/gtk.h>
#include <string.h>
#include <setjmp.h>
#include <sys/types.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkitemfactory.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkeditable.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtkhandlebox.h>
-#include <gtk/gtktoolbar.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtktreemodel.h>
-
-#include <gtk/gtkdnd.h>
-#include <gtk/gtkclipboard.h>
+#include <gtk/gtk.h>
+
#include <pango/pango-break.h>
#include <stdio.h>
#include <stdlib.h>
return;
}
personeditdlg.picture_set = TRUE;
- menu_set_sensitive(personeditdlg.editaddr_popupfactory,
- "/Unset picture", personeditdlg.picture_set);
+ cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", personeditdlg.picture_set);
g_free(filename);
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
g_object_unref(pixbuf);
stock_pixbuf_gdk(NULL, STOCK_PIXMAP_ANONYMOUS, &pixbuf);
personeditdlg.picture_set = FALSE;
- menu_set_sensitive(personeditdlg.editaddr_popupfactory,
- "/Unset picture", personeditdlg.picture_set);
+ cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", personeditdlg.picture_set);
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
}
-static void addressbook_edit_person_set_picture_menu_cb (void *obj, guint action, void *data)
+static void addressbook_edit_person_set_picture_menu_cb (GtkAction *action, gpointer data)
{
addressbook_edit_person_set_picture();
}
-static void addressbook_edit_person_unset_picture_menu_cb (void *obj, guint action, void *data)
+static void addressbook_edit_person_unset_picture_menu_cb (GtkAction *action, gpointer data)
{
addressbook_edit_person_clear_picture();
}
-static GtkItemFactoryEntry editaddr_popup_entries[] =
+static GtkWidget *editaddr_popup_menu = NULL;
+static GtkActionEntry editaddr_popup_entries[] =
{
- {N_("/_Set picture"), NULL, addressbook_edit_person_set_picture_menu_cb, 0, NULL, NULL},
- {N_("/_Unset picture"), NULL, addressbook_edit_person_unset_picture_menu_cb, 0, NULL, NULL},
+ {"EditAddressPopup", NULL, "EditAddressPopup" },
+ {"EditAddressPopup/SetPicture", NULL, N_("_Set picture"), NULL, NULL, G_CALLBACK(addressbook_edit_person_set_picture_menu_cb) },
+ {"EditAddressPopup/UnsetPicture", NULL, N_("_Unset picture"), NULL, NULL, G_CALLBACK(addressbook_edit_person_unset_picture_menu_cb) },
};
static void addressbook_edit_person_set_picture_cb(GtkWidget *widget,
if (event->button == 1) {
addressbook_edit_person_set_picture();
} else {
- gtk_menu_popup(GTK_MENU(personeditdlg.editaddr_popupmenu),
+ gtk_menu_popup(GTK_MENU(editaddr_popup_menu),
NULL, NULL, NULL, NULL,
event->button, event->time);
}
GtkWidget *entry_nn;
const gchar *locale;
gint top = 0;
- gint n_entries;
+ GtkActionGroup *action_group;
+
vbox = gtk_vbox_new( FALSE, 20 );
hbox = gtk_hbox_new( FALSE, 8 );
gtk_widget_show( vbox );
- /* set up picture context menu before we call addressbook_edit_person_clear_picture() */
- n_entries = sizeof(editaddr_popup_entries) /
- sizeof(editaddr_popup_entries[0]);
- personeditdlg.editaddr_popupmenu = menu_create_items(editaddr_popup_entries, n_entries,
- "<EditAddrPopupMenu>", &personeditdlg.editaddr_popupfactory,
- NULL);
+ if (!editaddr_popup_menu) {
+ action_group = cm_menu_create_action_group("EditAddressPopup", editaddr_popup_entries,
+ G_N_ELEMENTS(editaddr_popup_entries), (gpointer)NULL);
+ MENUITEM_ADDUI("/Menus", "EditAddressPopup", "EditAddressPopup", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus/EditAddressPopup", "SetPicture", "EditAddressPopup/SetPicture", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/EditAddressPopup", "UnsetPicture", "EditAddressPopup/UnsetPicture", GTK_UI_MANAGER_MENUITEM)
+ editaddr_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/EditAddressPopup")) );
+ }
/* User's picture */
ebox_picture = gtk_event_box_new();
frame_picture = gtk_frame_new(_("Photo"));
if( ADDRITEM_NAME(current_person) )
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_name), ADDRITEM_NAME(person) );
- menu_set_sensitive(personeditdlg.editaddr_popupfactory,
- "/Set picture", !personeditdlg.ldap);
- menu_set_sensitive(personeditdlg.editaddr_popupfactory,
- "/Unset picture", !personeditdlg.ldap);
+ cm_menu_set_sensitive("EditAddressPopup/SetPicture", !personeditdlg.ldap);
+ cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", !personeditdlg.ldap);
if( current_person->picture ) {
filename = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
current_person->picture, ".png", NULL );
goto no_img;
}
personeditdlg.picture_set = TRUE;
- menu_set_sensitive(personeditdlg.editaddr_popupfactory,
- "/Unset picture", !personeditdlg.ldap && personeditdlg.picture_set);
+ cm_menu_set_sensitive("EditAddressPopup/UnsetPicture", !personeditdlg.ldap && personeditdlg.picture_set);
} else {
goto no_img;
}
gboolean editNew;
gboolean read_only;
gboolean ldap;
- GtkItemFactory *editaddr_popupfactory;
- GtkWidget *editaddr_popupmenu;
};
#ifdef USE_LDAP
gboolean non_empty;
if (!apply_popup_menu) {
- actions = gtk_action_group_new("EditTags");
- gtk_action_group_add_actions(actions, apply_popup_actions,
+ actions = cm_menu_create_action_group("EditTags", apply_popup_actions,
G_N_ELEMENTS(apply_popup_actions), (gpointer)list_view);
- gtk_ui_manager_insert_action_group(gui_manager, actions, 0);
MENUITEM_ADDUI("/Menus", "EditTags", "EditTags", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI("/Menus/EditTags", "Delete", "EditTags/Delete",
static gboolean about_textview_uri_clicked(GtkTextTag *tag, GObject *obj,
GdkEvent *event, GtkTextIter *iter,
GtkWidget *textview);
-static void about_open_link_cb(GtkWidget *widget, guint action, void *data);
-static void about_copy_link_cb(GtkWidget *widget, guint action, void *data);
static gboolean about_textview_motion_notify(GtkWidget *widget,
GdkEventMotion *event,
GtkWidget *textview);
GtkWidget *textview);
static void about_textview_uri_update(GtkWidget *textview, gint x, gint y);
-static GtkItemFactoryEntry textview_link_popup_entries[] =
-{
- {N_("/_Open with Web browser"), NULL, about_open_link_cb, 0, NULL},
- {N_("/Copy this _link"), NULL, about_copy_link_cb, 0, NULL},
-};
-
static GtkWidget *link_popupmenu;
} else {
if (bevent->button == 3 && event->type == GDK_BUTTON_PRESS) {
- GtkItemFactory *link_popupfactory;
- gint n_entries;
-
- n_entries = sizeof(textview_link_popup_entries) /
- sizeof(textview_link_popup_entries[0]);
- link_popupmenu = menu_create_items(
- textview_link_popup_entries, n_entries,
- "<UriPopupMenu>", &link_popupfactory,
- textview);
+ link_popupmenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TextviewPopupLink")));
g_object_set_data(
G_OBJECT(link_popupmenu),
- "menu_button", link);
+ "raw_url", link);
gtk_menu_popup(GTK_MENU(link_popupmenu),
NULL, NULL, NULL, NULL,
bevent->button, bevent->time);
return FALSE;
}
-static void about_open_link_cb(GtkWidget *widget, guint action, void *data)
-{
- gchar *link = g_object_get_data(G_OBJECT(link_popupmenu),
- "menu_button");
-
- if (link == NULL) {
- return;
- }
-
- open_uri(link, prefs_common_get_uri_cmd());
- g_object_set_data(G_OBJECT(link_popupmenu), "menu_button",
- NULL);
-}
-
-static void about_copy_link_cb(GtkWidget *widget, guint action, void *data)
-{
- gchar *link = g_object_get_data(G_OBJECT(link_popupmenu),
- "menu_button");
-
- if (link == NULL) {
- return;
- }
-
- gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), link, -1);
- gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), link, -1);
- g_object_set_data(G_OBJECT(link_popupmenu), "menu_button", NULL);
-}
-
static gboolean about_textview_motion_notify(GtkWidget *widget,
GdkEventMotion *event,
GtkWidget *textview)
return gtk_item_factory_get_widget(*factory, path);
}
+GtkActionGroup *cm_menu_create_action_group(const gchar *name, GtkActionEntry **entries,
+ gint num_entries, gpointer data)
+{
+ GtkActionGroup *group = gtk_action_group_new(name);
+ gtk_action_group_set_translate_func(group, menu_translate, NULL, NULL);
+ gtk_action_group_add_actions(group, entries, num_entries, data);
+ gtk_ui_manager_insert_action_group(gtkut_ui_manager(), group, 0);
+ return group;
+}
+
gchar *menu_translate(const gchar *path, gpointer data)
{
gchar *retval;
g_free(path);
}
+void cm_toggle_menu_set_active(gchar *menu, gboolean active)
+{
+ GtkUIManager *gui_manager = gtkut_ui_manager();
+ GtkWidget *widget;
+ gchar *path = g_strdup_printf("/Menus/%s/", menu);
+
+ widget = gtk_ui_manager_get_widget(gui_manager, path);
+ if( !GTK_IS_WIDGET(widget) ) {
+ g_message("Blah, '%s' is not a widget.\n", path);
+ }
+
+ if( !GTK_CHECK_MENU_ITEM(widget) ) {
+ g_message("Blah, '%s' is not a check menu item.\n", path);
+ }
+
+ gtk_check_menu_item_set_active(widget, active);
+ g_free(path);
+}
+
void menu_set_sensitive_all(GtkMenuShell *menu_shell, gboolean sensitive)
{
GList *cur;
#define MENUITEM_ADDUI(path, name, action, type) \
gtk_ui_manager_add_ui(gtkut_ui_manager(), \
- gtk_ui_manager_new_merge_id(gui_manager),\
+ gtk_ui_manager_new_merge_id(gtkut_ui_manager()),\
path, name, action, type, FALSE);
#define MENUITEM_ADDUI_ID(path, name, action, type,id) \
const gchar *path,
gboolean sensitive);
+GtkActionGroup *cm_menu_create_action_group(const gchar *name, GtkActionEntry **entries,
+ gint num_entries, gpointer data);
void cm_menu_set_sensitive(gchar *menu, gboolean sensitive);
+void cm_toggle_menu_set_active(gchar *menu, gboolean active);
void menu_set_active (GtkItemFactory *ifactory,
const gchar *path,
#define ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win) \
gtk_window_add_accel_group \
(GTK_WINDOW(win), \
- gtk_item_factory_from_widget(menu)->accel_group); \
- g_signal_connect(G_OBJECT(gtk_item_factory_from_widget(menu)->accel_group), \
+ gtk_ui_manager_get_accel_group(gtkut_ui_manager())); \
+ g_signal_connect(G_OBJECT(gtk_ui_manager_get_accel_group(gtkut_ui_manager())), \
"accel_activate", \
G_CALLBACK(main_window_accel_activate), mainwin);
-
-
-/* ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
+
+ ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
- menu_connect_identical_items();
-*/
+/* FIXME menu_connect_identical_items(); */
+
#ifndef GENERIC_UMPC
gtk_window_iconify(GTK_WINDOW(mainwin->window));
#endif
ctree_mainbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(ctree_mainbox), scrolledwin, TRUE, TRUE, 0);
- actions = gtk_action_group_new("MimeView");
- gtk_action_group_add_actions(actions, mimeview_menu_actions,
+ actions = cm_menu_create_action_group("MimeView", mimeview_menu_actions,
G_N_ELEMENTS(mimeview_menu_actions), (gpointer)mimeview);
- gtk_ui_manager_insert_action_group(gui_manager, actions, 0);
MENUITEM_ADDUI("/Menus/", "MimeView", "MimeView", GTK_UI_MANAGER_MENU);
MENUITEM_ADDUI("/Menus/MimeView/", "Open", "MimeView/Open",
static GtkTooltips *tooltips;
#endif
static GtkWidget *traymenu_popup;
-static GtkItemFactory *traymenu_factory;
static gboolean updating_menu = FALSE;
guint destroy_signal_id;
TRAYICON_NOTHING
} TrayIconType;
-static void trayicon_get_all_cb (gpointer data, guint action, GtkWidget *widget);
-static void trayicon_compose_cb (gpointer data, guint action, GtkWidget *widget);
+static void trayicon_get_all_cb (GtkAction *action, gpointer data);
+static void trayicon_compose_cb (GtkAction *action, gpointer data);
static void trayicon_compose_acc_cb (GtkMenuItem *menuitem, gpointer data );
-static void trayicon_addressbook_cb (gpointer data, guint action, GtkWidget *widget);
-static void trayicon_exit_cb (gpointer data, guint action, GtkWidget *widget);
-static void trayicon_toggle_offline_cb (gpointer data, guint action, GtkWidget *widget);
+static void trayicon_addressbook_cb (GtkAction *action, gpointer data);
+static void trayicon_exit_cb (GtkAction *action, gpointer data);
+static void trayicon_toggle_offline_cb (GtkAction *action, gpointer data);
static void resize_cb (GtkWidget *widget, GtkRequisition *req, gpointer user_data);
-static GtkItemFactoryEntry trayicon_popup_menu_entries[] =
-{
- {N_("/_Get Mail"), NULL, trayicon_get_all_cb, 0, NULL},
- {"/---", NULL, NULL, 0, "<Separator>"},
- {N_("/_Email"), NULL, trayicon_compose_cb, 0, NULL},
- {N_("/_Email from account"), NULL, NULL, 0, "<Branch>"},
- {"/---", NULL, NULL, 0, "<Separator>"},
- {N_("/Open A_ddressbook"), NULL, trayicon_addressbook_cb, 0, NULL},
- {"/---", NULL, NULL, 0, "<Separator>"},
- {N_("/_Work Offline"), NULL, trayicon_toggle_offline_cb, 0, "<CheckItem>"},
- {"/---", NULL, NULL, 0, "<Separator>"},
- {N_("/E_xit Claws Mail"), NULL, trayicon_exit_cb, 0, NULL}
+static GtkActionEntry trayicon_popup_menu_entries[] =
+{
+ {"TrayiconPopup", NULL, "TrayiconPopup" },
+ {"TrayiconPopup/GetMail", NULL, N_("_Get Mail"), NULL, NULL, G_CALLBACK(trayicon_get_all_cb) },
+ {"TrayiconPopup/---", NULL, "---", NULL, NULL, G_CALLBACK(trayicon_compose_cb) },
+ {"TrayiconPopup/Email", NULL, N_("_Email"), NULL, NULL, G_CALLBACK(trayicon_compose_cb) },
+ {"TrayiconPopup/EmailAcc", NULL, N_("E_mail from account"), NULL, NULL, NULL },
+ {"TrayiconPopup/OpenAB", NULL, N_("Open A_ddressbook"), NULL, NULL, G_CALLBACK(trayicon_addressbook_cb) },
+ {"TrayiconPopup/Exit", NULL, N_("E_xit Claws Mail"), NULL, NULL, G_CALLBACK(trayicon_exit_cb) },
+};
+
+static GtkToggleActionEntry trayicon_popup_toggle_menu_entries[] =
+{
+ {"TrayiconPopup/ToggleOffline", NULL, N_("_Work Offline"), NULL, NULL, G_CALLBACK(trayicon_toggle_offline_cb) },
};
static gboolean trayicon_set_accounts_hook(gpointer source, gpointer data)
{
- GList *cur_ac, *cur_item = NULL;
- GtkWidget *menu;
+ GList *cur_ac;
+ GtkWidget *menu, *submenu;
GtkWidget *menuitem;
PrefsAccount *ac_prefs;
GList *account_list = account_get_list();
- menu = gtk_item_factory_get_widget(traymenu_factory,
- "/Email from account");
-
- /* destroy all previous menu item */
- cur_item = GTK_MENU_SHELL(menu)->children;
- while (cur_item != NULL) {
- GList *next = cur_item->next;
- gtk_widget_destroy(GTK_WIDGET(cur_item->data));
- cur_item = next;
- }
+ menu = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TrayiconPopup/EmailAcc");
+ gtk_widget_show(menu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), NULL);
+ submenu = gtk_menu_new();
for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
ac_prefs = (PrefsAccount *)cur_ac->data;
(ac_prefs->account_name ? ac_prefs->account_name
: _("Untitled"));
gtk_widget_show(menuitem);
- gtk_menu_append(GTK_MENU(menu), menuitem);
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
g_signal_connect(G_OBJECT(menuitem), "activate",
G_CALLBACK(trayicon_compose_acc_cb),
ac_prefs);
}
+ gtk_widget_show(submenu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
return FALSE;
}
/* tell callbacks to skip any event */
updating_menu = TRUE;
/* initialize checkitem according to current offline state */
- gtk_check_menu_item_set_active(
- GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(traymenu_factory,
- "/Work Offline")), prefs_common.work_offline);
- gtk_widget_set_sensitive(
- GTK_WIDGET(gtk_item_factory_get_item(traymenu_factory,
- "/Get Mail")), mainwin->lock_count == 0);
+ cm_toggle_menu_set_active("TrayiconPopup/ToggleOffline", prefs_common.work_offline);
+ cm_menu_set_sensitive("TrayiconPopup/GetMail", mainwin->lock_count == 0);
updating_menu = FALSE;
gtk_menu_popup( GTK_MENU(traymenu_popup), NULL, NULL, NULL, NULL,
static void create_trayicon()
{
- gint n_entries = 0;
-
+ GtkActionGroup *action_group;
trayicon = egg_tray_icon_new("Claws Mail");
gtk_widget_realize(GTK_WIDGET(trayicon));
gtk_window_set_default_size(GTK_WINDOW(trayicon), 16, 16);
tooltips = gtk_tooltips_new();
gtk_tooltips_enable(tooltips);
#endif
- n_entries = sizeof(trayicon_popup_menu_entries) /
- sizeof(trayicon_popup_menu_entries[0]);
- traymenu_popup = menu_create_items(trayicon_popup_menu_entries,
- n_entries, "<TrayiconMenu>", &traymenu_factory,
- NULL);
+
+ action_group = cm_menu_create_action_group("TrayiconPopup", trayicon_popup_menu_entries,
+ G_N_ELEMENTS(trayicon_popup_menu_entries), (gpointer)NULL);
+ gtk_action_group_add_toggle_actions(action_group, trayicon_popup_toggle_menu_entries,
+ G_N_ELEMENTS(trayicon_popup_toggle_menu_entries), (gpointer)NULL);
+
+ MENUITEM_ADDUI("/Menus", "TrayiconPopup", "TrayiconPopup", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "GetMail", "TrayiconPopup/GetMail", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator1", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "Email", "TrayiconPopup/Email", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "EmailAcc", "TrayiconPopup/EmailAcc", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator2", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "OpenAB", "TrayiconPopup/OpenAB", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator3", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "ToggleOffline", "TrayiconPopup/ToggleOffline", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator4", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI("/Menus/TrayiconPopup", "Exit", "TrayiconPopup/Exit", GTK_UI_MANAGER_MENUITEM)
+
+ traymenu_popup = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TrayiconPopup")) );
gtk_widget_show_all(GTK_WIDGET(trayicon));
/* popup menu callbacks */
-static void trayicon_get_all_cb( gpointer data, guint action, GtkWidget *widget )
+static void trayicon_get_all_cb( GtkAction *action, gpointer data )
{
MainWindow *mainwin = mainwindow_get_mainwindow();
inc_all_account_mail_cb(mainwin, 0, NULL);
}
-static void trayicon_compose_cb( gpointer data, guint action, GtkWidget *widget )
+static void trayicon_compose_cb( GtkAction *action, gpointer data )
{
MainWindow *mainwin = mainwindow_get_mainwindow();
compose_mail_cb(mainwin, 0, NULL);
compose_new((PrefsAccount *)data, NULL, NULL);
}
-static void trayicon_addressbook_cb( gpointer data, guint action, GtkWidget *widget )
+static void trayicon_addressbook_cb( GtkAction *action, gpointer data )
{
addressbook_open(NULL);
}
-static void trayicon_toggle_offline_cb( gpointer data, guint action, GtkWidget *widget )
+static void trayicon_toggle_offline_cb( GtkAction *action, gpointer data )
{
/* toggle offline mode if menu checkitem has been clicked */
if (!updating_menu) {
app_will_exit(NULL, mainwin);
}
-static void trayicon_exit_cb( gpointer data, guint action, GtkWidget *widget )
+static void trayicon_exit_cb( GtkAction *action, gpointer data )
{
MainWindow *mainwin = mainwindow_get_mainwindow();
gpointer data);
static void prefs_actions_substitute_cb (GtkWidget *w,
gpointer data);
-static void prefs_actions_delete_cb (GtkWidget *w,
- gpointer data);
-static void prefs_actions_delete_all_cb (GtkWidget *w,
- gpointer data);
-static void prefs_actions_clear_cb (void);
-static void prefs_actions_duplicate_cb (GtkWidget *w,
- gpointer data);
+static void prefs_actions_delete_cb (gpointer gtk_action, gpointer data);
+static void prefs_actions_delete_all_cb (gpointer gtk_action, gpointer data);
+static void prefs_actions_clear_cb (gpointer gtk_action, gpointer data);
+static void prefs_actions_duplicate_cb (gpointer gtk_action, gpointer data);
static void prefs_actions_up (GtkWidget *w,
gpointer data);
static void prefs_actions_down (GtkWidget *w,
modified_list = TRUE;
}
-static void prefs_actions_delete_cb(GtkWidget *w, gpointer data)
+static void prefs_actions_delete_cb(gpointer gtk_action, gpointer data)
{
GtkTreeIter sel;
GtkTreeModel *model;
modified_list = TRUE;
}
-static void prefs_actions_delete_all_cb(GtkWidget *w, gpointer data)
+static void prefs_actions_delete_all_cb(gpointer gtk_action, gpointer data)
{
GtkListStore *list_store;
modified_list = TRUE;
}
-static void prefs_actions_clear_cb(void)
+static void prefs_actions_clear_cb(gpointer gtk_action, gpointer data)
{
gint row;
modified = TRUE;
}
-static void prefs_actions_duplicate_cb(GtkWidget *w, gpointer data)
+static void prefs_actions_duplicate_cb(gpointer gtk_action, gpointer data)
{
gint row;
}
}
-static GtkItemFactory *prefs_actions_popup_factory = NULL;
+static GtkActionGroup *prefs_actions_popup_action = NULL;
static GtkWidget *prefs_actions_popup_menu = NULL;
-static GtkItemFactoryEntry prefs_actions_popup_entries[] =
+static GtkActionEntry prefs_actions_popup_entries[] =
{
- {N_("/_Delete"), NULL, prefs_actions_delete_cb, 0, NULL, NULL},
- {N_("/Delete _all"), NULL, prefs_actions_delete_all_cb, 0, NULL, NULL},
- {N_("/D_uplicate"), NULL, prefs_actions_duplicate_cb, 0, NULL, NULL},
+ {"PrefsActionsPopup", NULL, "PrefsActionsPopup" },
+ {"PrefsActionsPopup/Delete", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(prefs_actions_delete_cb) },
+ {"PrefsActionsPopup/DeleteAll", NULL, N_("Delete _all"), NULL, NULL, G_CALLBACK(prefs_actions_delete_all_cb) },
+ {"PrefsActionsPopup/Duplicate", NULL, N_("D_uplicate"), NULL, NULL, G_CALLBACK(prefs_actions_duplicate_cb) },
};
static gint prefs_actions_list_btn_pressed(GtkWidget *widget, GdkEventButton *event,
gint row;
if (!prefs_actions_popup_menu) {
- gint n_entries = sizeof(prefs_actions_popup_entries) /
- sizeof(prefs_actions_popup_entries[0]);
- prefs_actions_popup_menu = menu_create_items(prefs_actions_popup_entries,
- n_entries, "<PrefsActionsPopupMenu>",
- &prefs_actions_popup_factory, list_view);
+ prefs_actions_popup_action = cm_menu_create_action_group("PrefsActionsPopup", prefs_actions_popup_entries,
+ G_N_ELEMENTS(prefs_actions_popup_entries), (gpointer)list_view);
+ MENUITEM_ADDUI("/Menus", "PrefsActionsPopup", "PrefsActionsPopup", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus/PrefsActionsPopup", "Delete", "PrefsActionsPopup/Delete", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/PrefsActionsPopup", "DeleteAll", "PrefsActionsPopup/DeleteAll", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/PrefsActionsPopup", "Duplicate", "PrefsActionsPopup/Duplicate", GTK_UI_MANAGER_MENUITEM)
+ prefs_actions_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/PrefsActionsPopup")) );
}
/* grey out some popup menu items if there is no selected row */
row = gtkut_list_view_get_selected_row(GTK_WIDGET(list_view));
- menu_set_sensitive(prefs_actions_popup_factory, "/Delete", (row > 0));
- menu_set_sensitive(prefs_actions_popup_factory, "/Duplicate", (row > 0));
+ cm_menu_set_sensitive("PrefsActionsPopup/Delete", (row > 0));
+ cm_menu_set_sensitive("PrefsActionsPopup/Duplicate", (row > 0));
/* grey out seom popup menu items if there is no row
(not counting the (New) one at row 0) */
non_empty = gtk_tree_model_get_iter_first(model, &iter);
if (non_empty)
non_empty = gtk_tree_model_iter_next(model, &iter);
- menu_set_sensitive(prefs_actions_popup_factory, "/Delete all", non_empty);
+ cm_menu_set_sensitive("PrefsActionsPopup/DeleteAll", non_empty);
gtk_menu_popup(GTK_MENU(prefs_actions_popup_menu),
NULL, NULL, NULL, NULL,
static gboolean prefs_filtering_search_func_cb (GtkTreeModel *model, gint column,
const gchar *key, GtkTreeIter *iter,
gpointer search_data);
-static void prefs_filtering_register_cb (void);
-static void prefs_filtering_substitute_cb (void);
-static void prefs_filtering_delete_cb (void);
-static void prefs_filtering_delete_all_cb(void);
-static void prefs_filtering_clear_cb(void);
-static void prefs_filtering_duplicate_cb(void);
-static void prefs_filtering_top (void);
-static void prefs_filtering_page_up(void);
-static void prefs_filtering_up (void);
-static void prefs_filtering_down (void);
-static void prefs_filtering_page_down(void);
-static void prefs_filtering_bottom (void);
+static void prefs_filtering_register_cb (gpointer action, gpointer data);
+static void prefs_filtering_substitute_cb (gpointer action, gpointer data);
+static void prefs_filtering_delete_cb (gpointer action, gpointer data);
+static void prefs_filtering_delete_all_cb(gpointer action, gpointer data);
+static void prefs_filtering_clear_cb(gpointer action, gpointer data);
+static void prefs_filtering_duplicate_cb(gpointer action, gpointer data);
+static void prefs_filtering_top (gpointer action, gpointer data);
+static void prefs_filtering_page_up (gpointer action, gpointer data);
+static void prefs_filtering_up (gpointer action, gpointer data);
+static void prefs_filtering_down (gpointer action, gpointer data);
+static void prefs_filtering_page_down (gpointer action, gpointer data);
+static void prefs_filtering_bottom (gpointer action, gpointer data);
static gint prefs_filtering_deleted (GtkWidget *widget,
GdkEventAny *event,
gpointer data);
static gboolean prefs_filtering_key_pressed(GtkWidget *widget,
GdkEventKey *event,
gpointer data);
-static void prefs_filtering_cancel (void);
-static void prefs_filtering_ok (void);
+static void prefs_filtering_cancel (gpointer action, gpointer data);
+static void prefs_filtering_ok (gpointer action, gpointer data);
-static void prefs_filtering_condition_define (void);
-static void prefs_filtering_action_define(void);
+static void prefs_filtering_condition_define (gpointer action, gpointer data);
+static void prefs_filtering_action_define (gpointer action, gpointer data);
static gint prefs_filtering_list_view_set_row (gint row, FilteringProp * prop);
static void prefs_filtering_reset_dialog (void);
}
}
-static void prefs_filtering_condition_define(void)
+static void prefs_filtering_condition_define(gpointer action, gpointer data)
{
gchar * cond_str;
MatcherList * matchers = NULL;
}
}
-static void prefs_filtering_action_define(void)
+static void prefs_filtering_action_define(gpointer action, gpointer data)
{
gchar * action_str;
GSList * action_list = NULL;
return prop;
}
-static void prefs_filtering_register_cb(void)
+static void prefs_filtering_register_cb(gpointer action, gpointer data)
{
FilteringProp *prop;
modified = TRUE;
}
-static void prefs_filtering_substitute_cb(void)
+static void prefs_filtering_substitute_cb(gpointer action, gpointer data)
{
gint selected_row = gtkut_list_view_get_selected_row
(filtering.cond_list_view);
modified = TRUE;
}
-static void prefs_filtering_delete_cb(void)
+static void prefs_filtering_delete_cb(gpointer action, gpointer data)
{
GtkTreeView *list_view = GTK_TREE_VIEW(filtering.cond_list_view);
GtkTreeModel *model;
modified = TRUE;
}
-static void prefs_filtering_delete_all_cb(void)
+static void prefs_filtering_delete_all_cb(gpointer action, gpointer data)
{
GtkListStore *list_store;
modified = TRUE;
}
-static void prefs_filtering_clear_cb(void)
+static void prefs_filtering_clear_cb(gpointer action, gpointer data)
{
prefs_filtering_reset_dialog();
}
-static void prefs_filtering_duplicate_cb(void)
+static void prefs_filtering_duplicate_cb(gpointer action, gpointer data)
{
gint selected_row = gtkut_list_view_get_selected_row
(filtering.cond_list_view);
modified = TRUE;
}
-static void prefs_filtering_top(void)
+static void prefs_filtering_top(gpointer action, gpointer data)
{
gint row;
GtkTreeIter top, sel;
modified = TRUE;
}
-static void prefs_filtering_page_up(void)
+static void prefs_filtering_page_up(gpointer action, gpointer data)
{
gint row, target_row, n_rows;
GtkTreeIter selected, target;
gtkut_list_view_select_row(filtering.cond_list_view, target_row);
modified = TRUE;
}
-static void prefs_filtering_up(void)
+static void prefs_filtering_up(gpointer action, gpointer data)
{
gint row;
GtkTreeIter top, sel;
modified = TRUE;
}
-static void prefs_filtering_down(void)
+static void prefs_filtering_down(gpointer action, gpointer data)
{
gint row, n_rows;
GtkTreeIter top, sel;
modified = TRUE;
}
-static void prefs_filtering_page_down(void)
+static void prefs_filtering_page_down(gpointer action, gpointer data)
{
gint row, target_row, n_rows;
GtkTreeIter selected, target;
modified = TRUE;
}
-static void prefs_filtering_bottom(void)
+static void prefs_filtering_bottom(gpointer action, gpointer data)
{
gint row, n_rows;
GtkTreeIter top, sel;
static gint prefs_filtering_deleted(GtkWidget *widget, GdkEventAny *event,
gpointer data)
{
- prefs_filtering_cancel();
+ prefs_filtering_cancel(NULL, NULL);
return TRUE;
}
gpointer data)
{
if (event && event->keyval == GDK_Escape) {
- prefs_filtering_cancel();
+ prefs_filtering_cancel(NULL, NULL);
return TRUE;
}
return FALSE;
return FALSE;
}
-static void prefs_filtering_ok(void)
+static void prefs_filtering_ok(gpointer action, gpointer data)
{
if (prefs_filtering_check_mod(FALSE))
return;
prefs_filtering_close();
}
-static void prefs_filtering_cancel(void)
+static void prefs_filtering_cancel(gpointer action, gpointer data)
{
if (prefs_filtering_check_mod(TRUE))
return;
}
}
-static GtkItemFactory *prefs_filtering_popup_factory = NULL;
+static GtkActionGroup *prefs_filtering_popup_action = NULL;
static GtkWidget *prefs_filtering_popup_menu = NULL;
-static GtkItemFactoryEntry prefs_filtering_popup_entries[] =
+static GtkActionEntry prefs_filtering_popup_entries[] =
{
- {N_("/_Delete"), NULL, prefs_filtering_delete_cb, 0, NULL, NULL},
- {N_("/Delete _all"), NULL, prefs_filtering_delete_all_cb, 0, NULL, NULL},
- {N_("/D_uplicate"), NULL, prefs_filtering_duplicate_cb, 0, NULL, NULL},
+ {"PrefsFilteringPopup", NULL, "PrefsFilteringPopup" },
+ {"PrefsFilteringPopup/Delete", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(prefs_filtering_delete_cb) },
+ {"PrefsFilteringPopup/DeleteAll", NULL, N_("Delete _all"), NULL, NULL, G_CALLBACK(prefs_filtering_delete_all_cb) },
+ {"PrefsFilteringPopup/Duplicate", NULL, N_("D_uplicate"), NULL, NULL, G_CALLBACK(prefs_filtering_duplicate_cb) },
#ifdef GENERIC_UMPC
- {N_("/---"), NULL, NULL, 0, "<Separator>", NULL},
- {N_("/Move one page up"), NULL, prefs_filtering_page_up, 0, NULL, NULL},
- {N_("/Move one page down"), NULL, prefs_filtering_page_down, 0, NULL, NULL},
+ {"PrefsFilteringPopup/---", NULL, "---", NULL, NULL, NULL },
+ {"PrefsFilteringPopup/PageUp", NULL, N_("Move one page up"), NULL, NULL, G_CALLBACK(prefs_filtering_page_up) },
+ {"PrefsFilteringPopup/PageDown", NULL, N_("Move one page down"), NULL, NULL, G_CALLBACK(prefs_filtering_page_down) },
#endif
};
gint row;
if (!prefs_filtering_popup_menu) {
- gint n_entries = sizeof(prefs_filtering_popup_entries) /
- sizeof(prefs_filtering_popup_entries[0]);
- prefs_filtering_popup_menu = menu_create_items(prefs_filtering_popup_entries,
- n_entries, "<PrefsFilteringPopupMenu>",
- &prefs_filtering_popup_factory, list_view);
+ prefs_filtering_popup_action = cm_menu_create_action_group("PrefsFilteringPopup", prefs_filtering_popup_entries,
+ G_N_ELEMENTS(prefs_filtering_popup_entries), (gpointer)list_view);
+ MENUITEM_ADDUI("/Menus", "PrefsFilteringPopup", "PrefsFilteringPopup", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus/PrefsFilteringPopup", "Delete", "PrefsFilteringPopup/Delete", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/PrefsFilteringPopup", "DeleteAll", "PrefsFilteringPopup/DeleteAll", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/PrefsFilteringPopup", "Duplicate", "PrefsFilteringPopup/Duplicate", GTK_UI_MANAGER_MENUITEM)
+#ifdef GENERIC_UMPC
+ MENUITEM_ADDUI("/Menus/PrefsFilteringPopup", "Separator1", "PrefsFilteringPopup/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI("/Menus/PrefsFilteringPopup", "PageUp", "PrefsFilteringPopup/PageUp", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/PrefsFilteringPopup", "PageDown", "PrefsFilteringPopup/PageDown", GTK_UI_MANAGER_MENUITEM)
+#endif
+ prefs_filtering_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/PrefsFilteringPopup")) );
}
/* grey out some popup menu items if there is no selected row */
row = gtkut_list_view_get_selected_row(GTK_WIDGET(list_view));
- menu_set_sensitive(prefs_filtering_popup_factory, "/Delete", (row > 0));
- menu_set_sensitive(prefs_filtering_popup_factory, "/Duplicate", (row > 0));
+ cm_menu_set_sensitive("PrefsFilteringPopup/Delete", (row > 0));
+ cm_menu_set_sensitive("PrefsFilteringPopup/Duplicate", (row > 0));
/* grey out seom popup menu items if there is no row
(not counting the (New) one at row 0) */
non_empty = gtk_tree_model_get_iter_first(model, &iter);
if (non_empty)
non_empty = gtk_tree_model_iter_next(model, &iter);
- menu_set_sensitive(prefs_filtering_popup_factory, "/Delete all", non_empty);
+ cm_menu_set_sensitive("PrefsFilteringPopup/DeleteAll", non_empty);
gtk_menu_popup(GTK_MENU(prefs_filtering_popup_menu),
NULL, NULL, NULL, NULL,
static gboolean prefs_template_key_pressed_cb (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
-static void prefs_template_cancel_cb (void);
-static void prefs_template_ok_cb (void);
-static void prefs_template_register_cb (void);
-static void prefs_template_substitute_cb (void);
-static void prefs_template_delete_cb (void);
-static void prefs_template_delete_all_cb (void);
-static void prefs_template_clear_cb (void);
-static void prefs_template_duplicate_cb (void);
-static void prefs_template_top_cb (void);
-static void prefs_template_up_cb (void);
-static void prefs_template_down_cb (void);
-static void prefs_template_bottom_cb (void);
+static void prefs_template_cancel_cb (gpointer action, gpointer data);
+static void prefs_template_ok_cb (gpointer action, gpointer data);
+static void prefs_template_register_cb (gpointer action, gpointer data);
+static void prefs_template_substitute_cb (gpointer action, gpointer data);
+static void prefs_template_delete_cb (gpointer action, gpointer data);
+static void prefs_template_delete_all_cb (gpointer action, gpointer data);
+static void prefs_template_clear_cb (gpointer action, gpointer data);
+static void prefs_template_duplicate_cb (gpointer action, gpointer data);
+static void prefs_template_top_cb (gpointer action, gpointer data);
+static void prefs_template_up_cb (gpointer action, gpointer data);
+static void prefs_template_down_cb (gpointer action, gpointer data);
+static void prefs_template_bottom_cb (gpointer action, gpointer data);
static GtkListStore* prefs_template_create_data_store (void);
static void prefs_template_list_view_insert_template (GtkWidget *list_view,
(GtkAttachOptions) 0, 0, 0);
CLAWS_SET_TIP(*(widgets_table[i].entry),
widgets_table[i].tooltips);
-
- if (widgets_table[i].compl)
- address_completion_register_entry(
- GTK_ENTRY(*(widgets_table[i].entry)), TRUE);
}
/* template content */
G_CALLBACK(manual_open_with_anchor_cb),
MANUAL_ANCHOR_TEMPLATES);
- address_completion_start(window);
-
if (!geometry.min_height) {
geometry.min_width = 500;
geometry.min_height = 540;
GSList *tmpl_list;
GSList *cur;
Template *tmpl;
+ int i;
manage_window_set_transient(GTK_WINDOW(templates.window));
gtk_widget_grab_focus(templates.ok_btn);
tmpl_list = template_read_config();
+ address_completion_start(templates.window);
+
+ for (i=0; widgets_table[i].label; i++) {
+ if (widgets_table[i].compl)
+ address_completion_register_entry(
+ GTK_ENTRY(*(widgets_table[i].entry)), TRUE);
+ }
+
for (cur = tmpl_list; cur != NULL; cur = cur->next) {
tmpl = (Template *)cur->data;
prefs_template_list_view_insert_template(templates.list_view,
static gint prefs_template_deleted_cb(GtkWidget *widget, GdkEventAny *event,
gpointer data)
{
- prefs_template_cancel_cb();
+ prefs_template_cancel_cb(NULL, NULL);
return TRUE;
}
GdkEventKey *event, gpointer data)
{
if (event && event->keyval == GDK_Escape)
- prefs_template_cancel_cb();
+ prefs_template_cancel_cb(NULL, NULL);
else {
GtkWidget *focused = gtkut_get_focused_child(
GTK_CONTAINER(widget));
address_completion_end(templates.window);
}
-static void prefs_template_ok_cb(void)
+static void prefs_template_ok_cb(gpointer action, gpointer data)
{
GSList *tmpl_list;
GtkListStore *store;
inc_unlock();
}
-static void prefs_template_cancel_cb(void)
+static void prefs_template_cancel_cb(gpointer action, gpointer data)
{
GtkListStore *store;
return TRUE;
}
-static void prefs_template_register_cb(void)
+static void prefs_template_register_cb(gpointer action, gpointer data)
{
modified = !prefs_template_list_view_set_row(-1);
modified_list = TRUE;
}
-static void prefs_template_substitute_cb(void)
+static void prefs_template_substitute_cb(gpointer action, gpointer data)
{
Template *tmpl;
gint row;
modified_list = TRUE;
}
-static void prefs_template_delete_cb(void)
+static void prefs_template_delete_cb(gpointer action, gpointer data)
{
Template *tmpl;
gint row;
modified_list = TRUE;
}
-static void prefs_template_delete_all_cb(void)
+static void prefs_template_delete_all_cb(gpointer action, gpointer data)
{
GtkListStore *list_store;
modified_list = TRUE;
}
-static void prefs_template_duplicate_cb(void)
+static void prefs_template_duplicate_cb(gpointer action, gpointer data)
{
Template *tmpl;
gint row;
modified_list = !prefs_template_list_view_set_row(-row-2);
}
-static void prefs_template_clear_cb(void)
+static void prefs_template_clear_cb(gpointer action, gpointer data)
{
prefs_template_reset_dialog();
}
-static void prefs_template_top_cb(void)
+static void prefs_template_top_cb(gpointer action, gpointer data)
{
gint row;
GtkTreeIter top, sel;
modified_list = TRUE;
}
-static void prefs_template_up_cb(void)
+static void prefs_template_up_cb(gpointer action, gpointer data)
{
gint row;
GtkTreeIter top, sel;
modified_list = TRUE;
}
-static void prefs_template_down_cb(void)
+static void prefs_template_down_cb(gpointer action, gpointer data)
{
gint row, n_rows;
GtkTreeIter top, sel;
modified_list = TRUE;
}
-static void prefs_template_bottom_cb(void)
+static void prefs_template_bottom_cb(gpointer action, gpointer data)
{
gint row, n_rows;
GtkTreeIter top, sel;
}
}
-static GtkItemFactory *prefs_template_popup_factory = NULL;
+static GtkActionGroup *prefs_template_popup_action = NULL;
static GtkWidget *prefs_template_popup_menu = NULL;
-static GtkItemFactoryEntry prefs_template_popup_entries[] =
+static GtkActionEntry prefs_template_popup_entries[] =
{
- {N_("/_Delete"), NULL, prefs_template_delete_cb, 0, NULL, NULL},
- {N_("/Delete _all"), NULL, prefs_template_delete_all_cb, 0, NULL, NULL},
- {N_("/D_uplicate"), NULL, prefs_template_duplicate_cb, 0, NULL, NULL},
+ {"PrefsTemplatePopup", NULL, "PrefsTemplatePopup" },
+ {"PrefsTemplatePopup/Delete", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(prefs_template_delete_cb) },
+ {"PrefsTemplatePopup/DeleteAll", NULL, N_("Delete _all"), NULL, NULL, G_CALLBACK(prefs_template_delete_all_cb) },
+ {"PrefsTemplatePopup/Duplicate", NULL, N_("D_uplicate"), NULL, NULL, G_CALLBACK(prefs_template_duplicate_cb) },
};
static gint prefs_template_list_btn_pressed(GtkWidget *widget, GdkEventButton *event,
gint row;
if (!prefs_template_popup_menu) {
- gint n_entries = sizeof(prefs_template_popup_entries) /
- sizeof(prefs_template_popup_entries[0]);
- prefs_template_popup_menu = menu_create_items(prefs_template_popup_entries,
- n_entries, "<PrefsTemplatePopupMenu>",
- &prefs_template_popup_factory, list_view);
+ prefs_template_popup_action = cm_menu_create_action_group("PrefsTemplatePopup", prefs_template_popup_entries,
+ G_N_ELEMENTS(prefs_template_popup_entries), (gpointer)list_view);
+ MENUITEM_ADDUI("/Menus", "PrefsTemplatePopup", "PrefsTemplatePopup", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus/PrefsTemplatePopup", "Delete", "PrefsTemplatePopup/Delete", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/PrefsTemplatePopup", "DeleteAll", "PrefsTemplatePopup/DeleteAll", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/PrefsTemplatePopup", "Duplicate", "PrefsTemplatePopup/Duplicate", GTK_UI_MANAGER_MENUITEM)
+ prefs_template_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/PrefsTemplatePopup")) );
}
/* grey out some popup menu items if there is no selected row */
row = gtkut_list_view_get_selected_row(GTK_WIDGET(list_view));
- menu_set_sensitive(prefs_template_popup_factory, "/Delete", (row > 0));
- menu_set_sensitive(prefs_template_popup_factory, "/Duplicate", (row > 0));
+ cm_menu_set_sensitive("PrefsTemplatePopup/Delete", (row > 0));
+ cm_menu_set_sensitive("PrefsTemplatePopup/Duplicate", (row > 0));
/* grey out seom popup menu items if there is no row
(not counting the (New) one at row 0) */
non_empty = gtk_tree_model_get_iter_first(model, &iter);
if (non_empty)
non_empty = gtk_tree_model_iter_next(model, &iter);
- menu_set_sensitive(prefs_template_popup_factory, "/Delete all", non_empty);
+ cm_menu_set_sensitive("PrefsTemplatePopup/DeleteAll", non_empty);
gtk_menu_popup(GTK_MENU(prefs_template_popup_menu),
NULL, NULL, NULL, NULL,
G_CALLBACK(tog_searchbar_cb), summaryview);
/* create popup menu */
- summaryview->action_group = gtk_action_group_new("SummaryViewPopup");
- gtk_action_group_add_actions(summaryview->action_group, summary_popup_entries,
+ summaryview->action_group = cm_menu_create_action_group("SummaryViewPopup", summary_popup_entries,
G_N_ELEMENTS(summary_popup_entries), (gpointer)summaryview);
#ifndef GENERIC_UMPC
gtk_action_group_add_toggle_actions(summaryview->action_group, summary_popup_toggleentries,
G_N_ELEMENTS(summary_popup_toggleentries), (gpointer)summaryview);
#endif
- gtk_ui_manager_insert_action_group(gtkut_ui_manager(), summaryview->action_group, 0);
MENUITEM_ADDUI("/Menus", "SummaryViewPopup", "SummaryViewPopup", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Reply", "SummaryViewPopup/Reply", GTK_UI_MANAGER_MENUITEM)
{
SensitiveCond state;
gboolean sensitive;
-#ifndef GENERIC_UMPC
- GtkWidget *menuitem;
-#endif
gint i;
static const struct {
summary_lock(summaryview);
#ifndef GENERIC_UMPC
- menuitem = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/SummaryViewPopup/View/AllHeaders");
if (summaryview->messageview
&& summaryview->messageview->mimeview
&& summaryview->messageview->mimeview->textview)
- gtk_check_menu_item_set_active
- (GTK_CHECK_MENU_ITEM(menuitem),
- summaryview->messageview->mimeview->textview->show_all_headers);
+ cm_toggle_menu_set_active("SummaryViewPopup/View/AllHeaders",
+ summaryview->messageview->mimeview->textview->show_all_headers);
#endif
summary_unlock(summaryview);
}
ClickableText *uri,
gboolean expand_only);
-static void open_uri_cb (TextView *textview,
- guint action,
- void *data);
-static void copy_uri_cb (TextView *textview,
- guint action,
- void *data);
-static void add_uri_to_addrbook_cb (TextView *textview,
- guint action,
- void *data);
-static void mail_to_uri_cb (TextView *textview,
- guint action,
- void *data);
-static void copy_mail_to_uri_cb (TextView *textview,
- guint action,
- void *data);
-static void save_file_cb (TextView *textview,
- guint action,
- void *data);
-static void open_image_cb (TextView *textview,
- guint action,
- void *data);
+static void open_uri_cb (GtkAction *action,
+ TextView *textview);
+static void copy_uri_cb (GtkAction *action,
+ TextView *textview);
+static void add_uri_to_addrbook_cb (GtkAction *action,
+ TextView *textview);
+static void mail_to_uri_cb (GtkAction *action,
+ TextView *textview);
+static void copy_mail_to_uri_cb (GtkAction *action,
+ TextView *textview);
+static void save_file_cb (GtkAction *action,
+ TextView *textview);
+static void open_image_cb (GtkAction *action,
+ TextView *textview);
static void textview_show_tags(TextView *textview);
-static GtkItemFactoryEntry textview_link_popup_entries[] =
+static GtkActionEntry textview_link_popup_entries[] =
{
- {N_("/_Open with Web browser"), NULL, open_uri_cb, 0, NULL},
- {N_("/Copy this _link"), NULL, copy_uri_cb, 0, NULL},
+ {"TextviewPopupLink", NULL, "TextviewPopupLink" },
+ {"TextviewPopupLink/Open", NULL, N_("_Open in web browser"), NULL, NULL, G_CALLBACK(open_uri_cb) },
+ {"TextviewPopupLink/Copy", NULL, N_("Copy this _link"), NULL, NULL, G_CALLBACK(copy_uri_cb) },
};
-static GtkItemFactoryEntry textview_mail_popup_entries[] =
+static GtkActionEntry textview_mail_popup_entries[] =
{
- {N_("/Compose _new message"), NULL, mail_to_uri_cb, 0, NULL},
- {N_("/Add to _address book"), NULL, add_uri_to_addrbook_cb, 0, NULL},
- {N_("/Copy this add_ress"), NULL, copy_mail_to_uri_cb, 0, NULL},
+ {"TextviewPopupMail", NULL, "TextviewPopupMail" },
+ {"TextviewPopupMail/Compose", NULL, N_("Compose _new message"), NULL, NULL, G_CALLBACK(mail_to_uri_cb) },
+ {"TextviewPopupMail/AddAB", NULL, N_("Add to _Address book"), NULL, NULL, G_CALLBACK(add_uri_to_addrbook_cb) },
+ {"TextviewPopupMail/Copy", NULL, N_("Copy this add_ress"), NULL, NULL, G_CALLBACK(copy_mail_to_uri_cb) },
};
-static GtkItemFactoryEntry textview_file_popup_entries[] =
+static GtkActionEntry textview_file_popup_entries[] =
{
- {N_("/_Open image"), NULL, open_image_cb, 0, NULL},
- {N_("/_Save image..."), NULL, save_file_cb, 0, NULL},
+ {"TextviewPopupFile", NULL, "TextviewPopupFile" },
+ {"TextviewPopupFile/Open", NULL, N_("_Open image"), NULL, NULL, G_CALLBACK(open_image_cb) },
+ {"TextviewPopupFile/Save", NULL, N_("_Save image..."), NULL, NULL, G_CALLBACK(save_file_cb) },
};
static void scrolled_cb (GtkAdjustment *adj, TextView *textview)
GtkWidget *text;
GtkTextBuffer *buffer;
GtkClipboard *clipboard;
- GtkItemFactory *link_popupfactory, *mail_popupfactory, *file_popupfactory;
- GtkWidget *link_popupmenu, *mail_popupmenu, *file_popupmenu;
GtkAdjustment *adj;
- gint n_entries;
debug_print("Creating text view...\n");
textview = g_new0(TextView, 1);
gtk_widget_show(vbox);
- n_entries = sizeof(textview_link_popup_entries) /
- sizeof(textview_link_popup_entries[0]);
- link_popupmenu = menu_create_items(textview_link_popup_entries, n_entries,
- "<UriPopupMenu>", &link_popupfactory,
- textview);
-
- n_entries = sizeof(textview_mail_popup_entries) /
- sizeof(textview_mail_popup_entries[0]);
- mail_popupmenu = menu_create_items(textview_mail_popup_entries, n_entries,
- "<UriPopupMenu>", &mail_popupfactory,
- textview);
-
- n_entries = sizeof(textview_file_popup_entries) /
- sizeof(textview_file_popup_entries[0]);
- file_popupmenu = menu_create_items(textview_file_popup_entries, n_entries,
- "<FilePopupMenu>", &file_popupfactory,
- textview);
+
+ textview->link_action_group = cm_menu_create_action_group("TextviewPopupLink",
+ textview_link_popup_entries,
+ G_N_ELEMENTS(textview_link_popup_entries), (gpointer)textview);
+ textview->mail_action_group = cm_menu_create_action_group("TextviewPopupMail",
+ textview_mail_popup_entries,
+ G_N_ELEMENTS(textview_mail_popup_entries), (gpointer)textview);
+ textview->file_action_group = cm_menu_create_action_group("TextviewPopupFile",
+ textview_file_popup_entries,
+ G_N_ELEMENTS(textview_file_popup_entries), (gpointer)textview);
+
+ MENUITEM_ADDUI("/Menus", "TextviewPopupLink", "TextviewPopupLink", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus", "TextviewPopupMail", "TextviewPopupMail", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI("/Menus", "TextviewPopupFile", "TextviewPopupFile", GTK_UI_MANAGER_MENU)
+
+ MENUITEM_ADDUI("/Menus/TextviewPopupLink", "Open", "TextviewPopupLink/Open", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TextviewPopupLink", "Copy", "TextviewPopupLink/Copy", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TextviewPopupMail", "Compose", "TextviewPopupMail/Compose", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TextviewPopupMail", "AddAB", "TextviewPopupMail/AddAB", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TextviewPopupMail", "Copy", "TextviewPopupMail/Copy", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TextviewPopupFile", "Open", "TextviewPopupFile/Open", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI("/Menus/TextviewPopupFile", "Save", "TextviewPopupFile/Save", GTK_UI_MANAGER_MENUITEM)
+
+ textview->link_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TextviewPopupLink")) );
+ textview->mail_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TextviewPopupMail")) );
+ textview->file_popup_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+ gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TextviewPopupFile")) );
textview->vbox = vbox;
textview->scrolledwin = scrolledwin;
textview->body_pos = 0;
textview->show_all_headers = FALSE;
textview->last_buttonpress = GDK_NOTHING;
- textview->link_popup_menu = link_popupmenu;
- textview->link_popup_factory = link_popupfactory;
- textview->mail_popup_menu = mail_popupmenu;
- textview->mail_popup_factory = mail_popupfactory;
- textview->file_popup_menu = file_popupmenu;
- textview->file_popup_factory = file_popupfactory;
textview->image = NULL;
return textview;
}
g_slist_free(uri_list);
}
-static void open_uri_cb (TextView *textview, guint action, void *data)
+static void open_uri_cb (GtkAction *action, TextView *textview)
{
ClickableText *uri = g_object_get_data(G_OBJECT(textview->link_popup_menu),
"menu_button");
- if (uri == NULL)
- return;
+ const gchar *raw_url = g_object_get_data(G_OBJECT(textview->link_popup_menu),
+ "raw_url");
- if (textview_uri_security_check(textview, uri) == TRUE)
- open_uri(uri->uri,
- prefs_common_get_uri_cmd());
- g_object_set_data(G_OBJECT(textview->link_popup_menu), "menu_button",
- NULL);
+ if (uri) {
+ if (textview_uri_security_check(textview, uri) == TRUE)
+ open_uri(uri->uri,
+ prefs_common_get_uri_cmd());
+ g_object_set_data(G_OBJECT(textview->link_popup_menu), "menu_button",
+ NULL);
+ }
+ if (raw_url) {
+ open_uri(raw_url, prefs_common_get_uri_cmd());
+ g_object_set_data(G_OBJECT(textview->link_popup_menu), "raw_url",
+ NULL);
+ }
}
-static void open_image_cb (TextView *textview, guint action, void *data)
+static void open_image_cb (GtkAction *action, TextView *textview)
{
ClickableText *uri = g_object_get_data(G_OBJECT(textview->file_popup_menu),
"menu_button");
NULL);
}
-static void save_file_cb (TextView *textview, guint action, void *data)
+static void save_file_cb (GtkAction *action, TextView *textview)
{
ClickableText *uri = g_object_get_data(G_OBJECT(textview->file_popup_menu),
"menu_button");
NULL);
}
-static void copy_uri_cb (TextView *textview, guint action, void *data)
+static void copy_uri_cb (GtkAction *action, TextView *textview)
{
ClickableText *uri = g_object_get_data(G_OBJECT(textview->link_popup_menu),
"menu_button");
- if (uri == NULL)
- return;
-
- gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), uri->uri, -1);
- gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), uri->uri, -1);
- g_object_set_data(G_OBJECT(textview->link_popup_menu), "menu_button",
+ const gchar *raw_url = g_object_get_data(G_OBJECT(textview->link_popup_menu),
+ "raw_url");
+ if (uri) {
+ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), uri->uri, -1);
+ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), uri->uri, -1);
+ g_object_set_data(G_OBJECT(textview->link_popup_menu), "menu_button",
NULL);
+ }
+ if (raw_url) {
+ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), raw_url, -1);
+ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), raw_url, -1);
+ g_object_set_data(G_OBJECT(textview->link_popup_menu), "raw_url",
+ NULL);
+ }
}
-static void add_uri_to_addrbook_cb (TextView *textview, guint action, void *data)
+static void add_uri_to_addrbook_cb (GtkAction *action, TextView *textview)
{
gchar *fromname, *fromaddress;
ClickableText *uri = g_object_get_data(G_OBJECT(textview->mail_popup_menu),
g_free(fromname);
}
-static void mail_to_uri_cb (TextView *textview, guint action, void *data)
+static void mail_to_uri_cb (GtkAction *action, TextView *textview)
{
PrefsAccount *account = NULL;
ClickableText *uri = g_object_get_data(G_OBJECT(textview->mail_popup_menu),
}
}
-static void copy_mail_to_uri_cb (TextView *textview, guint action, void *data)
+static void copy_mail_to_uri_cb (GtkAction *action, TextView *textview)
{
ClickableText *uri = g_object_get_data(G_OBJECT(textview->mail_popup_menu),
"menu_button");
GtkWidget *scrolledwin;
GtkWidget *text;
+ GtkActionGroup *link_action_group;
GtkWidget *link_popup_menu;
- GtkItemFactory *link_popup_factory;
+ GtkActionGroup *mail_action_group;
GtkWidget *mail_popup_menu;
- GtkItemFactory *mail_popup_factory;
+ GtkActionGroup *file_action_group;
GtkWidget *file_popup_menu;
- GtkItemFactory *file_popup_factory;
gboolean default_text;
gboolean is_in_signature;
/* toolbar callbacks */
static void toolbar_reply (gpointer data,
- guint action);
+ guint action);
static void toolbar_learn (gpointer data,
- guint action);
+ guint action);
static void toolbar_delete_cb (GtkWidget *widget,
gpointer data);
static void toolbar_trash_cb (GtkWidget *widget,
{ "toolbar_compose.xml", NULL},
{ "toolbar_msgview.xml", NULL}
};
-#ifndef GENERIC_UMPC
-static GtkItemFactoryEntry reply_entries[] =
-{
- {N_("/Reply with _quote"), NULL, toolbar_reply, COMPOSE_REPLY_WITH_QUOTE, NULL},
- {N_("/_Reply without quote"), NULL, toolbar_reply, COMPOSE_REPLY_WITHOUT_QUOTE, NULL}
-};
-static GtkItemFactoryEntry replyall_entries[] =
-{
- {N_("/Reply to all with _quote"), "<shift>A", toolbar_reply, COMPOSE_REPLY_TO_ALL_WITH_QUOTE, NULL},
- {N_("/_Reply to all without quote"), "a", toolbar_reply, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE, NULL}
-};
-static GtkItemFactoryEntry replylist_entries[] =
-{
- {N_("/Reply to list with _quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_LIST_WITH_QUOTE, NULL},
- {N_("/_Reply to list without quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE, NULL}
-};
-static GtkItemFactoryEntry replysender_entries[] =
-{
- {N_("/Reply to sender with _quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE, NULL},
- {N_("/_Reply to sender without quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE, NULL}
-};
-static GtkItemFactoryEntry forward_entries[] =
-{
- {N_("/_Forward"), "f", toolbar_reply, COMPOSE_FORWARD_INLINE, NULL},
- {N_("/For_ward as attachment"), "<shift>F", toolbar_reply, COMPOSE_FORWARD_AS_ATTACH, NULL},
- {N_("/Redirec_t"), NULL, toolbar_reply, COMPOSE_REDIRECT, NULL}
-};
-#endif
-static GtkItemFactoryEntry learn_entries[] =
-{
- {N_("/Learn as _Spam"), NULL, toolbar_learn, TRUE, NULL},
- {N_("/Learn as _Ham"), NULL, toolbar_learn, FALSE, NULL}
-};
-
gint toolbar_ret_val_from_descr(const gchar *descr)
{
*/
static void toolbar_reply_cb(GtkWidget *widget, gpointer data)
{
- toolbar_reply(data, prefs_common.reply_with_quote ?
- COMPOSE_REPLY_WITH_QUOTE : COMPOSE_REPLY_WITHOUT_QUOTE);
+ toolbar_reply(data, (prefs_common.reply_with_quote ?
+ COMPOSE_REPLY_WITH_QUOTE : COMPOSE_REPLY_WITHOUT_QUOTE));
}
static void toolbar_reply_to_all_cb(GtkWidget *widget, gpointer data)
{
toolbar_reply(data,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_ALL_WITH_QUOTE
- : COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE);
+ (prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_ALL_WITH_QUOTE
+ : COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE));
}
static void toolbar_reply_to_list_cb(GtkWidget *widget, gpointer data)
{
toolbar_reply(data,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_LIST_WITH_QUOTE
- : COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE);
+ (prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_LIST_WITH_QUOTE
+ : COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE));
}
static void toolbar_reply_to_sender_cb(GtkWidget *widget, gpointer data)
{
toolbar_reply(data,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
- : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE);
+ (prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
+ : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE));
}
/*
*/
static void toolbar_forward_cb(GtkWidget *widget, gpointer data)
{
- toolbar_reply(data, COMPOSE_FORWARD);
+ toolbar_reply(data, (COMPOSE_FORWARD));
}
/*
}
#endif
-#define MAKE_MENU(entries,path,btn) { \
- n_menu_entries = sizeof(entries) / \
- sizeof(entries[0]); \
- menu = menu_create_items(entries, n_menu_entries, path, &factory, toolbar_item); \
- gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(btn), menu); \
+#define ADD_MENU_ITEM(name,cb,data) { \
+ item = gtk_menu_item_new_with_mnemonic(name); \
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); \
+ g_signal_connect(G_OBJECT(item), "activate", \
+ G_CALLBACK(cb), \
+ toolbar_item); \
+ g_object_set_data(G_OBJECT(item), "int-value", GINT_TO_POINTER(data)); \
+ gtk_widget_show(item); \
+}
+
+static void toolbar_reply_menu_cb(GtkWidget *widget, gpointer data)
+{
+ gpointer int_value = g_object_get_data(G_OBJECT(widget), "int-value");
+ ToolbarItem *toolbar_item = (ToolbarItem *)data;
+
+ toolbar_reply(toolbar_item, GPOINTER_TO_INT(int_value));
+}
+
+static void toolbar_learn_menu_cb(GtkWidget *widget, gpointer data)
+{
+ gpointer int_value = g_object_get_data(G_OBJECT(widget), "int-value");
+ ToolbarItem *toolbar_item = (ToolbarItem *)data;
+
+ toolbar_learn(toolbar_item, GPOINTER_TO_INT(int_value));
}
/**
GtkWidget *icon_news;
GtkWidget *icon_ham;
GtkWidget *item;
- GtkWidget *menu;
- guint n_menu_entries;
- GtkItemFactory *factory;
ToolbarClawsActions *action_item;
GSList *cur;
GSList *toolbar_list;
Toolbar *toolbar_data;
+ GtkWidget *menu;
#ifndef GENERIC_UMPC
#if !(GTK_CHECK_VERSION(2,12,0))
GtkTooltips *toolbar_tips = gtk_tooltips_new();
toolbar_data->learn_ham_icon = icon_ham;
g_object_ref(toolbar_data->learn_ham_icon);
- MAKE_MENU(learn_entries,"<LearnSpam>",toolbar_data->learn_spam_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("Learn as _Spam"), toolbar_learn_menu_cb, TRUE);
+ ADD_MENU_ITEM(_("Learn as _Ham"), toolbar_learn_menu_cb, FALSE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->learn_spam_btn), menu);
break;
case A_REPLY_MESSAGE:
#ifndef GENERIC_UMPC
_("Reply to Message options"));
toolbar_data->reply_btn = item;
- MAKE_MENU(reply_entries,"<Reply>",toolbar_data->reply_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->reply_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to Message"));
_("Reply to Sender options"));
toolbar_data->replysender_btn = item;
- MAKE_MENU(replysender_entries,"<ReplySender>",toolbar_data->replysender_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->replysender_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to Sender"));
_("Reply to All options"));
toolbar_data->replyall_btn = item;
- MAKE_MENU(replyall_entries,"<ReplyAll>",toolbar_data->replyall_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_ALL_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->replyall_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to All"));
_("Reply to Mailing-list options"));
toolbar_data->replylist_btn = item;
- MAKE_MENU(replylist_entries,"<ReplyList>",toolbar_data->replylist_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_LIST_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->replylist_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to Mailing-list"));
_("Forward Message options"));
toolbar_data->fwd_btn = item;
- MAKE_MENU(forward_entries,"<Forward>",toolbar_data->fwd_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Forward"), toolbar_reply_menu_cb, COMPOSE_FORWARD_INLINE);
+ ADD_MENU_ITEM(_("For_ward as attachment"), toolbar_reply_menu_cb, COMPOSE_FORWARD_AS_ATTACH);
+ ADD_MENU_ITEM(_("Redirec_t"), toolbar_reply_menu_cb, COMPOSE_REDIRECT);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->fwd_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Forward Message"));