aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmark-action-group.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-02-11 06:49:29 +0800
committerChristian Persch <chpe@src.gnome.org>2006-02-11 06:49:29 +0800
commit927100b2cb4b488d2581d63f764b74db976db69c (patch)
tree5bc83bbf59b42b3ac55d934716b53186a4d98664 /src/bookmarks/ephy-bookmark-action-group.c
parentf71767923318f72934fcd30be4dd47adb9f5b4de (diff)
downloadgsoc2013-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-bookmark-action-group.c')
-rw-r--r--src/bookmarks/ephy-bookmark-action-group.c80
1 files changed, 35 insertions, 45 deletions
diff --git a/src/bookmarks/ephy-bookmark-action-group.c b/src/bookmarks/ephy-bookmark-action-group.c
index 05630bd85..522d9bc0a 100644
--- a/src/bookmarks/ephy-bookmark-action-group.c
+++ b/src/bookmarks/ephy-bookmark-action-group.c
@@ -24,6 +24,7 @@
#include "ephy-bookmark-action-group.h"
#include "ephy-bookmark-action.h"
#include "ephy-bookmarks.h"
+#include "ephy-bookmarks-ui.h"
#include "ephy-link.h"
#include "ephy-node.h"
#include "ephy-node-common.h"
@@ -36,68 +37,57 @@
static void
smart_added_cb (EphyNode *parent,
EphyNode *child,
- GtkActionGroup *actions)
+ GtkActionGroup *action_group)
{
GtkAction *action;
- char *name;
-
- name = ephy_bookmark_action_name (child);
- g_return_if_fail (name);
- action = gtk_action_group_get_action (actions, name);
+ char name[EPHY_BOOKMARK_ACTION_NAME_BUFFER_SIZE];
+
+ EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, child);
+
+ action = gtk_action_group_get_action (action_group, name);
- if (action)
+ if (action != NULL)
{
- ephy_bookmark_action_updated
- (EPHY_BOOKMARK_ACTION (action));
+ ephy_bookmark_action_updated ((EphyBookmarkAction *) action);
}
-
- g_free (name);
}
-
static void
smart_removed_cb (EphyNode *parent,
EphyNode *child,
guint index,
- GtkActionGroup *actions)
+ GtkActionGroup *action_group)
{
GtkAction *action;
- char *name;
-
- name = ephy_bookmark_action_name (child);
- g_return_if_fail (name);
- action = gtk_action_group_get_action (actions, name);
+ char name[EPHY_BOOKMARK_ACTION_NAME_BUFFER_SIZE];
+
+ EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, child);
+
+ action = gtk_action_group_get_action (action_group, name);
- if (action)
+ if (action != NULL)
{
- ephy_bookmark_action_updated
- (EPHY_BOOKMARK_ACTION (action));
+ ephy_bookmark_action_updated ((EphyBookmarkAction *) action);
}
-
- g_free (name);
}
static void
node_changed_cb (EphyNode *parent,
EphyNode *child,
guint property_id,
- GtkActionGroup *actions)
+ GtkActionGroup *action_group)
{
GtkAction *action;
- char *name;
-
- name = ephy_bookmark_action_name (child);
- g_assert (name != NULL);
+ char name[EPHY_BOOKMARK_ACTION_NAME_BUFFER_SIZE];
- action = gtk_action_group_get_action (actions, name);
+ EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, child);
+
+ action = gtk_action_group_get_action (action_group, name);
- if (action)
+ if (action != NULL)
{
- ephy_bookmark_action_updated
- (EPHY_BOOKMARK_ACTION (action));
+ ephy_bookmark_action_updated ((EphyBookmarkAction *) action);
}
-
- g_free (name);
}
static void
@@ -106,22 +96,22 @@ node_added_cb (EphyNode *parent,
GtkActionGroup *action_group)
{
GtkAction *action;
- char *name, *accel;
-
- name = ephy_bookmark_action_name (child);
+ char name[EPHY_BOOKMARK_ACTION_NAME_BUFFER_SIZE];
+ char accel[256];
+
+ EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, child);
+
action = ephy_bookmark_action_new (child, name);
- 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);
+ ephy_bookmark_action_updated ((EphyBookmarkAction *) action);
- ephy_bookmark_action_updated (EPHY_BOOKMARK_ACTION (action));
-
g_signal_connect_swapped (action, "open-link",
G_CALLBACK (ephy_link_open), action_group);
}
@@ -139,7 +129,7 @@ node_removed_cb (EphyNode *parent,
action = gtk_action_group_get_action (action_group, name);
- if (action)
+ if (action != NULL)
{
gtk_action_group_remove_action (action_group, action);
}