diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-02-11 06:49:29 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-02-11 06:49:29 +0800 |
commit | 927100b2cb4b488d2581d63f764b74db976db69c (patch) | |
tree | 5bc83bbf59b42b3ac55d934716b53186a4d98664 /src/bookmarks/ephy-open-tabs-action.c | |
parent | f71767923318f72934fcd30be4dd47adb9f5b4de (diff) | |
download | gsoc2013-epiphany-927100b2cb4b488d2581d63f764b74db976db69c.tar gsoc2013-epiphany-927100b2cb4b488d2581d63f764b74db976db69c.tar.gz gsoc2013-epiphany-927100b2cb4b488d2581d63f764b74db976db69c.tar.bz2 gsoc2013-epiphany-927100b2cb4b488d2581d63f764b74db976db69c.tar.lz gsoc2013-epiphany-927100b2cb4b488d2581d63f764b74db976db69c.tar.xz gsoc2013-epiphany-927100b2cb4b488d2581d63f764b74db976db69c.tar.zst gsoc2013-epiphany-927100b2cb4b488d2581d63f764b74db976db69c.zip |
Remove *_action_name functions, and use static buffers instead. Minor
2006-02-10 Christian Persch <chpe@cvs.gnome.org>
* src/bookmarks/ephy-bookmark-action-group.c: (smart_added_cb),
(smart_removed_cb), (node_changed_cb), (node_added_cb),
(node_removed_cb):
* src/bookmarks/ephy-bookmark-action.c: (ephy_bookmark_action_new):
* src/bookmarks/ephy-bookmark-action.h:
* src/bookmarks/ephy-bookmark-factory-action.c:
(build_menu_for_topic):
* src/bookmarks/ephy-bookmarks-editor.c: (cmd_toolbar),
(ephy_bookmarks_editor_update_menu):
* src/bookmarks/ephy-bookmarks-menu.c: (append_bookmarks),
(append_menu), (ephy_bookmarks_menu_build):
* src/bookmarks/ephy-bookmarks-ui.c:
(ephy_bookmarks_ui_attach_window), (topic_has_data),
(topic_get_data), (topic_get_name), (bookmark_has_data),
(bookmark_get_data), (bookmark_get_name), (bookmark_new_name),
(toolbar_node_removed_cb):
* src/bookmarks/ephy-bookmarks-ui.h:
* src/bookmarks/ephy-open-tabs-action.c: (node_added_cb),
(node_removed_cb), (ephy_open_tabs_group_new):
* src/bookmarks/ephy-open-tabs-action.h:
* src/bookmarks/ephy-topic-action-group.c: (node_changed_cb),
(node_added_cb), (node_removed_cb), (ephy_topic_action_group_new):
* src/bookmarks/ephy-topic-action-group.h:
* src/bookmarks/ephy-topic-action.c: (ephy_topic_action_new):
* src/bookmarks/ephy-topic-action.h:
* src/bookmarks/ephy-topic-factory-action.c: (build_menu):
Remove *_action_name functions, and use static buffers instead.
Minor cleanups.
Diffstat (limited to 'src/bookmarks/ephy-open-tabs-action.c')
-rw-r--r-- | src/bookmarks/ephy-open-tabs-action.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/bookmarks/ephy-open-tabs-action.c b/src/bookmarks/ephy-open-tabs-action.c index eb0955446..7b54f5365 100644 --- a/src/bookmarks/ephy-open-tabs-action.c +++ b/src/bookmarks/ephy-open-tabs-action.c @@ -23,6 +23,7 @@ #include "ephy-open-tabs-action.h" #include "ephy-bookmarks.h" +#include "ephy-bookmarks-ui.h" #include "ephy-node-common.h" #include "ephy-link-action.h" #include "ephy-link.h" @@ -67,14 +68,14 @@ node_added_cb (EphyNode *parent, { GObject *action_object; GtkAction *action; - char *name, *accel; - - name = ephy_open_tabs_action_name (child); - g_assert (name != NULL); + char name[EPHY_TOPIC_ACTION_NAME_BUFFER_SIZE]; + char accel[256]; + EPHY_TOPIC_ACTION_NAME_PRINTF (name, child); + /* FIXME !!!! */ action = gtk_action_new (name, _("Open in New _Tabs"), "Open this topic in tabs", NULL); - action_object = G_OBJECT (action); + action_object = (GObject *) action; g_object_set_data (action_object, "ephy-node", child); g_object_set_data (action_object, "ephy-link", EPHY_LINK (action_group)); @@ -82,17 +83,13 @@ node_added_cb (EphyNode *parent, g_signal_connect (action, "activate", G_CALLBACK (activate_cb), NULL); - accel = g_strjoin ("/", "<Actions>", - gtk_action_group_get_name (action_group), - name, - NULL); + g_snprintf (accel, sizeof (accel), "<Actions>/%s/%s", + gtk_action_group_get_name (action_group), + name); gtk_action_set_accel_path (action, accel); gtk_action_group_add_action (action_group, action); g_object_unref (action); - - g_free (accel); - g_free (name); } static void @@ -102,16 +99,15 @@ node_removed_cb (EphyNode *parent, GtkActionGroup *action_group) { GtkAction *action; - char *name; + char name[EPHY_TOPIC_ACTION_NAME_BUFFER_SIZE]; - name = ephy_open_tabs_action_name (child); + EPHY_TOPIC_ACTION_NAME_PRINTF (name, child); + + action = gtk_action_group_get_action (action_group, name); - // FIXME can this really ever be NULL ?? - if (name) + if (action != NULL) { - action = gtk_action_group_get_action (action_group, name); - if (action) gtk_action_group_remove_action (action_group, action); - g_free (name); + gtk_action_group_remove_action (action_group, action); } } @@ -140,9 +136,3 @@ ephy_open_tabs_group_new (EphyNode *node) return action_group; } - -char * -ephy_open_tabs_action_name (EphyNode *node) -{ - return g_strdup_printf("OpTb%u", ephy_node_get_id (node)); -} |