gnome-panel r11407 - in trunk/gnome-panel: . libpanel-util
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11407 - in trunk/gnome-panel: . libpanel-util
- Date: Wed, 10 Dec 2008 04:35:31 +0000 (UTC)
Author: vuntz
Date: Wed Dec 10 04:35:31 2008
New Revision: 11407
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11407&view=rev
Log:
2008-12-10 Vincent Untz <vuntz gnome org>
Stop using GnomeHelp, and use gtk_show_uri() for displaying help.
* panel-util.[ch]: (panel_show_help): kill
* libpanel-util/panel-show.[ch]: (_panel_show_error_dialog): use
g_markup_printf_escaped()
(panel_show_uri):
(panel_show_uri_force_mime_type): fix a check
(_panel_show_help_error_dialog), (_panel_show_help_handle_error),
(panel_show_help): new, they all do what their name imply
* applet.c: (applet_callback_callback):
* panel-action-button.c: (panel_action_button_invoke_menu):
* panel-addto.c: (panel_addto_dialog_response):
* panel-context-menu.c: (panel_context_menu_show_help):
* panel-ditem-editor.c: (response_cb):
* panel-menu-bar.c: (panel_menu_bar_invoke_menu):
* panel-menu-button.c: (panel_menu_button_invoke_menu):
* panel-properties-dialog.c: (panel_properties_dialog_response):
* panel-run-dialog.c: (panel_run_dialog_response):
updates for panel_show_help()
* panel-action-button.c: fix help for "connect to server"
* libpanel-util/panel-launch.c: (_panel_launch_error_dialog): escape
the name of the application since it will be used inside markup
(_panel_launch_handle_error): new, to factorize code
(panel_app_info_launch_uris):
(panel_launch_desktop_file_with_fallback): use
_panel_launch_handle_error()
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/applet.c
trunk/gnome-panel/libpanel-util/panel-launch.c
trunk/gnome-panel/libpanel-util/panel-show.c
trunk/gnome-panel/libpanel-util/panel-show.h
trunk/gnome-panel/panel-action-button.c
trunk/gnome-panel/panel-addto.c
trunk/gnome-panel/panel-context-menu.c
trunk/gnome-panel/panel-ditem-editor.c
trunk/gnome-panel/panel-menu-bar.c
trunk/gnome-panel/panel-menu-button.c
trunk/gnome-panel/panel-properties-dialog.c
trunk/gnome-panel/panel-run-dialog.c
trunk/gnome-panel/panel-util.c
trunk/gnome-panel/panel-util.h
Modified: trunk/gnome-panel/applet.c
==============================================================================
--- trunk/gnome-panel/applet.c (original)
+++ trunk/gnome-panel/applet.c Wed Dec 10 04:35:31 2008
@@ -14,6 +14,8 @@
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
+#include <libpanel-util/panel-show.h>
+
#include "button-widget.h"
#include "drawer.h"
#include "launcher.h"
@@ -247,7 +249,8 @@
panel_properties_dialog_present (drawer->toplevel);
} else if (strcmp (menu->name, "help") == 0) {
- panel_show_help (screen, "user-guide.xml", "gospanel-18");
+ panel_show_help (screen,
+ "user-guide", "gospanel-18", NULL);
}
break;
case PANEL_OBJECT_MENU:
Modified: trunk/gnome-panel/libpanel-util/panel-launch.c
==============================================================================
--- trunk/gnome-panel/libpanel-util/panel-launch.c (original)
+++ trunk/gnome-panel/libpanel-util/panel-launch.c Wed Dec 10 04:35:31 2008
@@ -42,7 +42,8 @@
char *primary;
if (name)
- primary = g_strdup_printf (_("Could not launch '%s'"), name);
+ primary = g_markup_printf_escaped (_("Could not launch '%s'"),
+ name);
else
primary = g_strdup (_("Could not launch application"));
@@ -51,6 +52,32 @@
g_free (primary);
}
+static gboolean
+_panel_launch_handle_error (const gchar *name,
+ GdkScreen *screen,
+ GError *local_error,
+ GError **error)
+{
+ if (local_error == NULL)
+ return TRUE;
+
+ else if (g_error_matches (local_error,
+ G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_error_free (local_error);
+ return TRUE;
+ }
+
+ else if (error != NULL)
+ g_propagate_error (error, local_error);
+
+ else {
+ _panel_launch_error_dialog (name, screen, local_error->message);
+ g_error_free (local_error);
+ }
+
+ return FALSE;
+}
+
gboolean
panel_app_info_launch_uris (GAppInfo *appinfo,
GList *uris,
@@ -77,20 +104,8 @@
g_object_unref (context);
- if (retval)
- return TRUE;
-
- /* handle error */
- if (error != NULL)
- g_propagate_error (error, local_error);
-
- else {
- _panel_launch_error_dialog (g_app_info_get_name (appinfo),
- screen, local_error->message);
- g_error_free (local_error);
- }
-
- return FALSE;
+ return _panel_launch_handle_error (g_app_info_get_name (appinfo),
+ screen, local_error, error);
}
gboolean
@@ -214,18 +229,6 @@
G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, &local_error);
- if (retval)
- return TRUE;
-
- /* handle error */
- if (error != NULL)
- g_propagate_error (error, local_error);
-
- else {
- _panel_launch_error_dialog (fallback_exec,
- screen, local_error->message);
- g_error_free (local_error);
- }
-
- return FALSE;
+ return _panel_launch_handle_error (fallback_exec,
+ screen, local_error, error);
}
Modified: trunk/gnome-panel/libpanel-util/panel-show.c
==============================================================================
--- trunk/gnome-panel/libpanel-util/panel-show.c (original)
+++ trunk/gnome-panel/libpanel-util/panel-show.c Wed Dec 10 04:35:31 2008
@@ -39,14 +39,10 @@
GdkScreen *screen,
const gchar *message)
{
- char *escaped;
char *primary;
- escaped = g_markup_escape_text (uri, -1);
- primary = g_strdup_printf (_("Could not open location '%s'"),
- escaped);
- g_free (escaped);
-
+ primary = g_markup_printf_escaped (_("Could not open location '%s'"),
+ uri);
panel_error_dialog (NULL, screen, "cannot_show_url", TRUE,
primary, message);
g_free (primary);
@@ -182,7 +178,7 @@
{
GError *local_error = NULL;
- g_return_val_if_fail (screen != NULL, FALSE);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -207,7 +203,7 @@
GAppInfo *app;
gboolean ret;
- g_return_val_if_fail (screen != NULL, FALSE);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (mime_type != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -228,3 +224,67 @@
return ret;
}
+
+static void
+_panel_show_help_error_dialog (const gchar *doc,
+ GdkScreen *screen,
+ const gchar *message)
+{
+ char *primary;
+
+ primary = g_markup_printf_escaped (_("Could not display help document '%s'"),
+ doc);
+ panel_error_dialog (NULL, screen, "cannot_show_help", TRUE,
+ primary, message);
+ g_free (primary);
+}
+
+static gboolean
+_panel_show_help_handle_error (const gchar *doc,
+ GdkScreen *screen,
+ GError *local_error,
+ GError **error)
+{
+ if (local_error == NULL)
+ return TRUE;
+
+ else if (g_error_matches (local_error,
+ G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_error_free (local_error);
+ return TRUE;
+ }
+
+ else if (error != NULL)
+ g_propagate_error (error, local_error);
+
+ else {
+ _panel_show_help_error_dialog (doc, screen,
+ local_error->message);
+ g_error_free (local_error);
+ }
+
+ return FALSE;
+}
+
+gboolean
+panel_show_help (GdkScreen *screen,
+ const gchar *doc,
+ const gchar *link,
+ GError **error)
+{
+ GError *local_error = NULL;
+ char *uri;
+
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
+ g_return_val_if_fail (doc != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (link)
+ uri = g_strdup_printf ("ghelp:%s?%s", doc, link);
+ else
+ uri = g_strdup_printf ("ghelp:%s", doc);
+
+ gtk_show_uri (screen, uri, gtk_get_current_event_time (), &local_error);
+
+ return _panel_show_help_handle_error (doc, screen, local_error, error);
+}
Modified: trunk/gnome-panel/libpanel-util/panel-show.h
==============================================================================
--- trunk/gnome-panel/libpanel-util/panel-show.h (original)
+++ trunk/gnome-panel/libpanel-util/panel-show.h Wed Dec 10 04:35:31 2008
@@ -40,6 +40,11 @@
guint32 timestamp,
GError **error);
+gboolean panel_show_help (GdkScreen *screen,
+ const gchar *doc,
+ const gchar *link,
+ GError **error);
+
G_END_DECLS
#endif /* PANEL_SHOW_H */
Modified: trunk/gnome-panel/panel-action-button.c
==============================================================================
--- trunk/gnome-panel/panel-action-button.c (original)
+++ trunk/gnome-panel/panel-action-button.c Wed Dec 10 04:35:31 2008
@@ -35,6 +35,7 @@
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-launch.h>
#include <libpanel-util/panel-session-manager.h>
+#include <libpanel-util/panel-show.h>
#include "applet.h"
#include "panel-config-global.h"
@@ -338,7 +339,7 @@
PANEL_ICON_REMOTE, //FIXME icon
N_("Connect to Server..."),
N_("Connect to a remote computer or shared disk"),
- "gospanel-563", //FIXME
+ "nautilus-server-connect", //FIXME
"ACTION:connect-server:NEW",
panel_action_connect_server, NULL, NULL, NULL
},
@@ -816,8 +817,8 @@
screen = gtk_widget_get_screen (GTK_WIDGET (button));
- panel_show_help (screen, "user-guide.xml",
- actions [button->priv->type].help_index);
+ panel_show_help (screen, "user-guide",
+ actions [button->priv->type].help_index, NULL);
return;
}
Modified: trunk/gnome-panel/panel-addto.c
==============================================================================
--- trunk/gnome-panel/panel-addto.c (original)
+++ trunk/gnome-panel/panel-addto.c Wed Dec 10 04:35:31 2008
@@ -32,6 +32,7 @@
#include <gmenu-tree.h>
#include <libpanel-util/panel-glib.h>
+#include <libpanel-util/panel-show.h>
#include "launcher.h"
#include "panel.h"
@@ -851,7 +852,7 @@
switch (response_id) {
case GTK_RESPONSE_HELP:
panel_show_help (gtk_window_get_screen (GTK_WINDOW (dialog->addto_dialog)),
- "user-guide.xml", "gospanel-15");
+ "user-guide", "gospanel-15", NULL);
break;
case PANEL_ADDTO_RESPONSE_ADD:
Modified: trunk/gnome-panel/panel-context-menu.c
==============================================================================
--- trunk/gnome-panel/panel-context-menu.c (original)
+++ trunk/gnome-panel/panel-context-menu.c Wed Dec 10 04:35:31 2008
@@ -35,6 +35,7 @@
#include <gdk/gdkkeysyms.h>
#include <libpanel-util/panel-error.h>
+#include <libpanel-util/panel-show.h>
#include "nothing.h"
#include "panel-util.h"
@@ -53,7 +54,7 @@
gpointer data)
{
panel_show_help (gtk_widget_get_screen (w),
- "user-guide.xml", "gospanel-1");
+ "user-guide", "gospanel-1", NULL);
}
static gboolean
Modified: trunk/gnome-panel/panel-ditem-editor.c
==============================================================================
--- trunk/gnome-panel/panel-ditem-editor.c (original)
+++ trunk/gnome-panel/panel-ditem-editor.c Wed Dec 10 04:35:31 2008
@@ -31,9 +31,9 @@
#include <gtk/gtk.h>
#include <libgnomeui/gnome-icon-entry.h>
-#include <libgnomeui/gnome-help.h>
#include <libpanel-util/panel-keyfile.h>
+#include <libpanel-util/panel-show.h>
#include "panel-ditem-editor.h"
#include "panel-icon-names.h"
@@ -1445,11 +1445,8 @@
switch (response_id) {
case GTK_RESPONSE_HELP:
- if (!gnome_help_display_desktop_on_screen (NULL, "user-guide",
- "user-guide",
- "gospanel-52",
- gtk_window_get_screen (GTK_WINDOW (dialog)),
- &error)) {
+ if (!panel_show_help (gtk_window_get_screen (GTK_WINDOW (dialog)),
+ "user-guide", "gospanel-52", &error)) {
g_signal_emit (G_OBJECT (dialog),
ditem_edit_signals[ERROR_REPORTED], 0,
_("Could not display help document"),
Modified: trunk/gnome-panel/panel-menu-bar.c
==============================================================================
--- trunk/gnome-panel/panel-menu-bar.c (original)
+++ trunk/gnome-panel/panel-menu-bar.c Wed Dec 10 04:35:31 2008
@@ -33,6 +33,7 @@
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-launch.h>
+#include <libpanel-util/panel-show.h>
#include "panel-util.h"
#include "panel-background.h"
@@ -395,7 +396,7 @@
screen = gtk_widget_get_screen (GTK_WIDGET (menubar));
if (!strcmp (callback_name, "help")) {
- panel_show_help (screen, "user-guide.xml", "menubar");
+ panel_show_help (screen, "user-guide", "menubar", NULL);
} else if (!strcmp (callback_name, "edit")) {
GError *error = NULL;
Modified: trunk/gnome-panel/panel-menu-button.c
==============================================================================
--- trunk/gnome-panel/panel-menu-button.c (original)
+++ trunk/gnome-panel/panel-menu-button.c Wed Dec 10 04:35:31 2008
@@ -33,6 +33,7 @@
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-launch.h>
+#include <libpanel-util/panel-show.h>
#include "applet.h"
#include "panel-widget.h"
@@ -970,7 +971,7 @@
screen = gtk_widget_get_screen (GTK_WIDGET (button));
if (!strcmp (callback_name, "help")) {
- panel_show_help (screen, "user-guide.xml", "gospanel-37");
+ panel_show_help (screen, "user-guide", "gospanel-37", NULL);
} else if (!strcmp (callback_name, "edit")) {
GError *error = NULL;
Modified: trunk/gnome-panel/panel-properties-dialog.c
==============================================================================
--- trunk/gnome-panel/panel-properties-dialog.c (original)
+++ trunk/gnome-panel/panel-properties-dialog.c Wed Dec 10 04:35:31 2008
@@ -33,6 +33,7 @@
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-glib.h>
+#include <libpanel-util/panel-show.h>
#include "nothing.h"
#include "panel-profile.h"
@@ -645,7 +646,7 @@
help_id = "gospanel-28";
}
panel_show_help (gtk_window_get_screen (GTK_WINDOW (properties_dialog)),
- "user-guide.xml", help_id);
+ "user-guide", help_id, NULL);
break;
default:
break;
Modified: trunk/gnome-panel/panel-run-dialog.c
==============================================================================
--- trunk/gnome-panel/panel-run-dialog.c (original)
+++ trunk/gnome-panel/panel-run-dialog.c Wed Dec 10 04:35:31 2008
@@ -453,7 +453,7 @@
break;
case GTK_RESPONSE_HELP:
panel_show_help (gtk_window_get_screen (GTK_WINDOW (run_dialog)),
- "user-guide.xml", "gospanel-23");
+ "user-guide", "gospanel-23", NULL);
break;
default:
break;
Modified: trunk/gnome-panel/panel-util.c
==============================================================================
--- trunk/gnome-panel/panel-util.c (original)
+++ trunk/gnome-panel/panel-util.c Wed Dec 10 04:35:31 2008
@@ -17,6 +17,7 @@
#include "panel-util.h"
#include <dirent.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -28,8 +29,6 @@
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomeui/gnome-help.h>
-
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-glib.h>
#include <libpanel-util/panel-keyfile.h>
@@ -75,22 +74,6 @@
return g_string_free (str, FALSE);
}
-void
-panel_show_help (GdkScreen *screen,
- const char *doc_name,
- const char *linkid)
-{
- GError *error = NULL;
-
- if (!gnome_help_display_desktop_on_screen (NULL, "user-guide", doc_name, linkid, screen, &error)) {
- panel_error_dialog (NULL, screen, "cannot_show_help", TRUE,
- _("Could not display help document"),
- error != NULL ? error->message : NULL);
-
- g_clear_error (&error);
- }
-}
-
int
panel_find_applet_index (GtkWidget *widget)
{
Modified: trunk/gnome-panel/panel-util.h
==============================================================================
--- trunk/gnome-panel/panel-util.h (original)
+++ trunk/gnome-panel/panel-util.h Wed Dec 10 04:35:31 2008
@@ -10,10 +10,6 @@
char * panel_util_make_exec_uri_for_desktop (const char *exec);
-void panel_show_help (GdkScreen *screen,
- const char *path,
- const char *linkid);
-
int panel_find_applet_index (GtkWidget *widget);
void panel_push_window_busy (GtkWidget *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]