aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-topic-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-topic-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-topic-action-group.c')
-rw-r--r--src/bookmarks/ephy-topic-action-group.c90
1 files changed, 46 insertions, 44 deletions
diff --git a/src/bookmarks/ephy-topic-action-group.c b/src/bookmarks/ephy-topic-action-group.c
index 29c0668ff..d94e2897f 100644
--- a/src/bookmarks/ephy-topic-action-group.c
+++ b/src/bookmarks/ephy-topic-action-group.c
@@ -25,102 +25,104 @@
#include "ephy-node.h"
#include "ephy-node-common.h"
#include "ephy-bookmarks.h"
+#include "ephy-bookmarks-ui.h"
#include "ephy-debug.h"
#include <gtk/gtkaction.h>
#include <gtk/gtkactiongroup.h>
-#include <string.h>
-
static void
node_changed_cb (EphyNode *parent,
EphyNode *child,
guint property_id,
- GtkActionGroup *actions)
+ GtkActionGroup *action_group)
{
GtkAction *action;
- char *name;
-
- name = ephy_topic_action_name (child);
- g_return_if_fail (name != NULL);
- action = gtk_action_group_get_action (actions, name);
+ char name[EPHY_TOPIC_ACTION_NAME_BUFFER_SIZE];
+
+ EPHY_TOPIC_ACTION_NAME_PRINTF (name, child);
+
+ action = gtk_action_group_get_action (action_group, name);
if (property_id == EPHY_NODE_KEYWORD_PROP_NAME)
{
ephy_topic_action_updated (EPHY_TOPIC_ACTION (action));
}
-
- g_free (name);
}
static void
node_added_cb (EphyNode *parent,
EphyNode *child,
- GtkActionGroup *actions)
+ GtkActionGroup *action_group)
{
GtkUIManager *manager;
GtkAction *action;
- char *name, *accel;
-
- manager = g_object_get_data ((GObject *)actions, "ui-manager");
- name = ephy_topic_action_name (child);
+ char name[EPHY_TOPIC_ACTION_NAME_BUFFER_SIZE];
+ char accel[256];
+
+ EPHY_TOPIC_ACTION_NAME_PRINTF (name, child);
+
+ manager = g_object_get_data ((GObject *) action_group, "ui-manager");
+
action = ephy_topic_action_new (child, manager, name);
- accel = g_strjoin ("/", "<Actions>",
- gtk_action_group_get_name (actions),
- 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 (actions, action);
+
+ gtk_action_group_add_action (action_group, action);
g_object_unref (action);
- g_free (accel);
- g_free (name);
- ephy_topic_action_updated (EPHY_TOPIC_ACTION (action));
+ ephy_topic_action_updated ((EphyTopicAction *) action);
}
static void
node_removed_cb (EphyNode *parent,
EphyNode *child, guint index,
- GtkActionGroup *actions)
+ GtkActionGroup *action_group)
{
GtkAction *action;
- char *name;
+ char name[EPHY_TOPIC_ACTION_NAME_BUFFER_SIZE];
+
+ EPHY_TOPIC_ACTION_NAME_PRINTF (name, child);
- name = ephy_topic_action_name (child);
- g_return_if_fail (name != NULL);
- action = gtk_action_group_get_action (actions, name);
+ action = gtk_action_group_get_action (action_group, name);
if (action)
{
- gtk_action_group_remove_action (actions, action);
+ gtk_action_group_remove_action (action_group, action);
}
-
- g_free (name);
}
GtkActionGroup *
-ephy_topic_group_new (EphyNode *node,
- GtkUIManager *manager)
+ephy_topic_action_group_new (EphyNode *node,
+ GtkUIManager *manager)
{
- GPtrArray *children = ephy_node_get_children (node);
- GObject *actions = (GObject *) gtk_action_group_new ("TopicActions");
- gint i;
+ GPtrArray *children;
+ GtkActionGroup *action_group;
+ int i;
- g_object_set_data (G_OBJECT (actions), "ui-manager", manager);
+ children = ephy_node_get_children (node);
+ action_group = gtk_action_group_new ("TpAc");
+
+ g_object_set_data ((GObject *) action_group, "ui-manager", manager);
for (i = 0; i < children->len; i++)
{
- node_added_cb (node, g_ptr_array_index (children, i), (GtkActionGroup *)actions);
+ node_added_cb (node, g_ptr_array_index (children, i),
+ action_group);
}
ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_ADDED,
- (EphyNodeCallback)node_added_cb,
- actions);
+ (EphyNodeCallback) node_added_cb,
+ (GObject *) action_group);
ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_REMOVED,
- (EphyNodeCallback)node_removed_cb,
- actions);
+ (EphyNodeCallback) node_removed_cb,
+ (GObject *) action_group);
ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_CHANGED,
- (EphyNodeCallback)node_changed_cb,
- actions);
+ (EphyNodeCallback) node_changed_cb,
+ (GObject *) action_group);
- return GTK_ACTION_GROUP (actions);
+ return (GtkActionGroup *) action_group;
}