aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-03-15 02:41:35 +0800
committerChristian Persch <chpe@src.gnome.org>2005-03-15 02:41:35 +0800
commitcf6aa33a55708514144f27220b71a66adb8232a3 (patch)
treef1a9bb91563f46490cf469d98bb0a5324e94c48e
parent79b688e5ae5c412faf82c4c62aa58913b735feb6 (diff)
downloadgsoc2013-epiphany-cf6aa33a55708514144f27220b71a66adb8232a3.tar
gsoc2013-epiphany-cf6aa33a55708514144f27220b71a66adb8232a3.tar.gz
gsoc2013-epiphany-cf6aa33a55708514144f27220b71a66adb8232a3.tar.bz2
gsoc2013-epiphany-cf6aa33a55708514144f27220b71a66adb8232a3.tar.lz
gsoc2013-epiphany-cf6aa33a55708514144f27220b71a66adb8232a3.tar.xz
gsoc2013-epiphany-cf6aa33a55708514144f27220b71a66adb8232a3.tar.zst
gsoc2013-epiphany-cf6aa33a55708514144f27220b71a66adb8232a3.zip
Support "Multimedia" keys. Fixes bug #162748.
2005-03-14 Christian Persch <chpe@cvs.gnome.org> * data/ui/epiphany-ui.xml: * src/ephy-window.c: (ephy_window_key_press_event), (setup_multimedia_key_actions), (setup_ui_manager): * src/window-commands.c: (window_cmd_go_home): * src/window-commands.h: Support "Multimedia" keys. Fixes bug #162748.
-rw-r--r--ChangeLog10
-rw-r--r--data/ui/epiphany-ui.xml14
-rw-r--r--src/ephy-window.c64
-rw-r--r--src/window-commands.c22
-rw-r--r--src/window-commands.h5
5 files changed, 114 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d0d42737b..7a1f9f46c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2005-03-14 Christian Persch <chpe@cvs.gnome.org>
+ * data/ui/epiphany-ui.xml:
+ * src/ephy-window.c: (ephy_window_key_press_event),
+ (setup_multimedia_key_actions), (setup_ui_manager):
+ * src/window-commands.c: (window_cmd_go_home):
+ * src/window-commands.h:
+
+ Support "Multimedia" keys. Fixes bug #162748.
+
+2005-03-14 Christian Persch <chpe@cvs.gnome.org>
+
* src/ephy-tabs-menu.c: (tab_added_cb):
Use connect_object, to guard against "title" signal emitted
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 520dfeb6b..ab5a0e6af 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -223,5 +223,19 @@
<accelerator name="BrowseWithCaretAccel" action="BrowseWithCaret"/>
<accelerator name="FileSaveAccel" action="FileSave"/>
+<accelerator name="XFKeyHomePageAccel" action="XFKeyHomePage"/>
+<accelerator name="XFKeyBackAccel" action="XFKeyBack"/>
+<accelerator name="XFKeyForwardAccel" action="XFKeyForward"/>
+<accelerator name="XFKeyStopAccel" action="XFKeyStop"/>
+<accelerator name="XFKeyRefreshAccel" action="XFKeyRefresh"/>
+<accelerator name="XFKeyFavoritesAccel" action="XFKeyFavorites"/>
+<accelerator name="XFKeyHistoryAccel" action="XFKeyHistory"/>
+<accelerator name="XFKeyOpenURLAccel" action="XFKeyOpenURL"/>
+<accelerator name="XFKeyAddFavoriteAccel" action="XFKeyAddFavorite"/>
+<accelerator name="XFKeyGoAccel" action="XFKeyGo"/>
+<accelerator name="XFKeyReloadAccel" action="XFKeyReload"/>
+<accelerator name="XFKeySendToAccel" action="XFKeySendTo"/>
+<accelerator name="XFKeyZoomInAccel" action="XFKeyZoomIn"/>
+<accelerator name="XFKeyZoomOutAccel" action="XFKeyZoomOut"/>
</ui>
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 420a074c8..dc7681e22 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -70,6 +70,10 @@
#include <gtk/gtkdialog.h>
#include <gtk/gtkmessagedialog.h>
+#ifdef HAVE_X11_XF86KEYSYM_H
+#include <X11/XF86keysym.h>
+#endif
+
static void ephy_window_class_init (EphyWindowClass *klass);
static void ephy_window_link_iface_init (EphyLinkIface *iface);
static void ephy_window_init (EphyWindow *gs);
@@ -356,6 +360,31 @@ static GtkActionEntry ephy_popups_entries [] = {
};
static guint ephy_popups_n_entries = G_N_ELEMENTS (ephy_popups_entries);
+#ifdef HAVE_X11_XF86KEYSYM_H
+static const struct
+{
+ const char *name;
+ guint keyval;
+ GCallback callback;
+} const multimedia_actions [] = {
+ { "XFKeyHomePage", XF86XK_HomePage, G_CALLBACK (window_cmd_go_home ) },
+ { "XFKeyBack", XF86XK_Back, G_CALLBACK (window_cmd_go_back ) },
+ { "XFKeyForward", XF86XK_Forward, G_CALLBACK (window_cmd_go_forward ) },
+ { "XFKeyStop", XF86XK_Stop, G_CALLBACK (window_cmd_view_stop ) },
+ { "XFKeyRefresh", XF86XK_Refresh, G_CALLBACK (window_cmd_view_reload ) },
+ { "XFKeyFavorites", XF86XK_Favorites, G_CALLBACK (window_cmd_go_bookmarks ) },
+ { "XFKeyHistory", XF86XK_History, G_CALLBACK (window_cmd_go_history ) },
+ { "XFKeyOpenURL", XF86XK_OpenURL, G_CALLBACK (window_cmd_go_location ) },
+ { "XFKeyAddFavorite", XF86XK_AddFavorite, G_CALLBACK (window_cmd_file_bookmark_page ) },
+ { "XFKeyGo", XF86XK_Go, G_CALLBACK (window_cmd_go_location ) },
+ { "XFKeyReload", XF86XK_Reload, G_CALLBACK (window_cmd_view_reload ) },
+ { "XFKeySendTo", XF86XK_Send, G_CALLBACK (window_cmd_file_send_to) },
+ { "XFKeyZoomIn", XF86XK_ZoomIn, G_CALLBACK (window_cmd_view_zoom_in ) },
+ { "XFKeyZoomOut", XF86XK_ZoomOut, G_CALLBACK (window_cmd_view_zoom_out) }
+ /* FIXME: what about ScrollUp, ScrollDown, Menu*, Option, LogOff, Save,.. any others? */
+};
+#endif /* HAVE_X11_XF86KEYSYM_H */
+
#define CONF_LOCKDOWN_HIDE_MENUBAR "/apps/epiphany/lockdown/hide_menubar"
#define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename"
@@ -711,7 +740,7 @@ ephy_window_key_press_event (GtkWidget *widget,
{
menubar = gtk_ui_manager_get_widget (window->priv->manager, "/menubar");
g_return_val_if_fail (menubar != NULL , FALSE);
-
+
if (!GTK_WIDGET_VISIBLE (menubar))
{
g_signal_connect (menubar, "deactivate",
@@ -1069,6 +1098,35 @@ update_actions_sensitivity (EphyWindow *window)
update_print_actions (window, TRUE);
}
+#ifdef HAVE_X11_XF86KEYSYM_H
+static void
+setup_multimedia_key_actions (EphyWindow *window)
+{
+ GtkActionGroup *action_group = window->priv->action_group;
+ GtkAction *action;
+ const char *agname, *name;
+ char *accel_path;
+ guint i;
+
+ agname = gtk_action_group_get_name (action_group);
+
+ for (i = 0; i < G_N_ELEMENTS (multimedia_actions); i++)
+ {
+ name = multimedia_actions[i].name;
+
+ action = g_object_new (GTK_TYPE_ACTION, "name", name, NULL);
+ g_signal_connect (action, "activate",
+ multimedia_actions[i].callback, window);
+
+ accel_path = g_strconcat ("<Actions>/", agname, "/", name, NULL);
+ gtk_action_set_accel_path (action, accel_path);
+ gtk_accel_map_add_entry (accel_path, multimedia_actions[i].keyval, 0);
+ gtk_action_group_add_action (action_group, action);
+ g_free (accel_path);
+ }
+}
+#endif /* HAVE_X11_XF86KEYSYM_H */
+
static void
setup_ui_manager (EphyWindow *window)
{
@@ -1136,6 +1194,10 @@ setup_ui_manager (EphyWindow *window)
g_signal_connect (manager, "add_widget", G_CALLBACK (add_widget), window);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (manager));
+
+#ifdef HAVE_X11_XF86KEYSYM_H
+ setup_multimedia_key_actions (window);
+#endif
}
static void
diff --git a/src/window-commands.c b/src/window-commands.c
index e4d54d24c..2b06e2ca5 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -912,3 +912,25 @@ window_cmd_browse_with_caret (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
eel_gconf_set_boolean (CONF_BROWSE_WITH_CARET, active);
}
+
+#ifdef HAVE_X11_XF86KEYSYM_H
+void
+window_cmd_go_home (GtkAction *action,
+ EphyWindow *window)
+{
+ char *location;
+
+ location = eel_gconf_get_string (CONF_GENERAL_HOMEPAGE);
+
+ if (location == NULL || location[0] == '\0')
+ {
+ g_free (location);
+
+ location = g_strdup ("about:blank");
+ }
+
+ ephy_window_load_url (window, location);
+
+ g_free (location);
+}
+#endif /* HAVE_X11_XF86KEYSYM_H */
diff --git a/src/window-commands.h b/src/window-commands.h
index 39ff5707d..4669b3971 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -165,3 +165,8 @@ void window_cmd_load_location (GtkAction *action,
void window_cmd_browse_with_caret (GtkAction *action,
EphyWindow *window);
+
+#ifdef HAVE_X11_XF86KEYSYM_H
+void window_cmd_go_home (GtkAction *action,
+ EphyWindow *window);
+#endif