aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/shortcut-bar
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/shortcut-bar')
-rw-r--r--widgets/shortcut-bar/ChangeLog15
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.c51
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.h12
3 files changed, 72 insertions, 6 deletions
diff --git a/widgets/shortcut-bar/ChangeLog b/widgets/shortcut-bar/ChangeLog
index 5ee884aa9b..93bf8e9175 100644
--- a/widgets/shortcut-bar/ChangeLog
+++ b/widgets/shortcut-bar/ChangeLog
@@ -1,3 +1,18 @@
+2000-09-25 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shortcut-bar.c (e_shortcut_bar_destroy): Call
+ `e_shortcut_bar_disconnect_model()'.
+ (e_shortcut_bar_on_drag_data_received): Don't add the item to the
+ model here; the view is only supposed to act as a view. Rather,
+ emit the "dropped_shortcut" signal appropriately.
+ (e_shortcut_bar_on_drag_data_delete): Likewise, don't remove the
+ item from the model and emit "shortcut_dragged".
+ (e_shortcut_bar_class_init): Install the "shortcut_dropped" and
+ "shortcut_dragged" signals.
+
+ * e-shortcut-bar.h: New signals "shortcut_dropped",
+ "shortcut_dragged". "selected_item" changed to "item_selected".
+
2000-09-18 Christopher James Lahey <clahey@helixcode.com>
* Makefile.am: Added $(EXTRA_GNOME_CFLAGS) and
diff --git a/widgets/shortcut-bar/e-shortcut-bar.c b/widgets/shortcut-bar/e-shortcut-bar.c
index 2826f612d5..0a29ef3729 100644
--- a/widgets/shortcut-bar/e-shortcut-bar.c
+++ b/widgets/shortcut-bar/e-shortcut-bar.c
@@ -134,6 +134,8 @@ static GdkPixbuf* e_shortcut_bar_load_image (const gchar *filename);
enum
{
ITEM_SELECTED,
+ SHORTCUT_DROPPED,
+ SHORTCUT_DRAGGED,
LAST_SIGNAL
};
@@ -141,6 +143,21 @@ static guint e_shortcut_bar_signals[LAST_SIGNAL] = {0};
static EGroupBarClass *parent_class;
+static void
+e_shortcut_bar_marshal_NONE__INT_INT_STRING_STRING (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args)
+{
+ void (*rfunc) (GtkObject *, gint, gint, gchar *, gchar *, gpointer) = func;
+
+ (*rfunc) (object,
+ GTK_VALUE_INT (args[0]),
+ GTK_VALUE_INT (args[1]),
+ GTK_VALUE_STRING (args[2]),
+ GTK_VALUE_STRING (args[3]),
+ func_data);
+}
E_MAKE_TYPE(e_shortcut_bar, "EShortcutBar", EShortcutBar,
e_shortcut_bar_class_init, e_shortcut_bar_init,
@@ -163,11 +180,33 @@ e_shortcut_bar_class_init (EShortcutBarClass *class)
GTK_RUN_LAST | GTK_RUN_ACTION,
object_class->type,
GTK_SIGNAL_OFFSET (EShortcutBarClass,
- selected_item),
+ item_selected),
gtk_marshal_NONE__POINTER_INT_INT,
GTK_TYPE_NONE, 3, GTK_TYPE_GDK_EVENT,
GTK_TYPE_INT, GTK_TYPE_INT);
+ e_shortcut_bar_signals[SHORTCUT_DROPPED] =
+ gtk_signal_new ("shortcut_dropped",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShortcutBarClass, shortcut_dropped),
+ e_shortcut_bar_marshal_NONE__INT_INT_STRING_STRING,
+ GTK_TYPE_NONE, 4,
+ GTK_TYPE_INT,
+ GTK_TYPE_INT,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING);
+
+ e_shortcut_bar_signals[SHORTCUT_DRAGGED] =
+ gtk_signal_new ("shortcut_dragged",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShortcutBarClass, shortcut_dragged),
+ gtk_marshal_NONE__INT_INT,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT,
+ GTK_TYPE_INT);
+
gtk_object_class_add_signals (object_class, e_shortcut_bar_signals,
LAST_SIGNAL);
@@ -207,6 +246,8 @@ e_shortcut_bar_destroy (GtkObject *object)
g_array_free (shortcut_bar->groups, TRUE);
+ e_shortcut_bar_disconnect_model (shortcut_bar);
+
g_free (shortcut_bar->dragged_url);
g_free (shortcut_bar->dragged_name);
@@ -623,8 +664,9 @@ e_shortcut_bar_on_drag_data_received (GtkWidget *widget,
group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar),
GTK_WIDGET (icon_bar)->parent);
- e_shortcut_model_add_item (shortcut_bar->model, group_num,
- position, item_url, item_name);
+ gtk_signal_emit (GTK_OBJECT (shortcut_bar),
+ e_shortcut_bar_signals[SHORTCUT_DROPPED],
+ group_num, position, item_url, item_name);
gtk_drag_finish (context, TRUE, TRUE, time);
return;
@@ -647,8 +689,7 @@ e_shortcut_bar_on_drag_data_delete (GtkWidget *widget,
group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar),
widget->parent);
- e_shortcut_model_remove_item (shortcut_bar->model, group_num,
- icon_bar->dragged_item_num);
+ gtk_signal_emit (GTK_OBJECT (shortcut_bar), group_num, icon_bar->dragged_item_num);
}
diff --git a/widgets/shortcut-bar/e-shortcut-bar.h b/widgets/shortcut-bar/e-shortcut-bar.h
index 573303d290..bfa33634e3 100644
--- a/widgets/shortcut-bar/e-shortcut-bar.h
+++ b/widgets/shortcut-bar/e-shortcut-bar.h
@@ -89,10 +89,20 @@ struct _EShortcutBarClass
{
EGroupBarClass parent_class;
- void (*selected_item) (EShortcutBar *shortcut_bar,
+ void (*item_selected) (EShortcutBar *shortcut_bar,
GdkEvent *event,
gint group_num,
gint item_num);
+
+ void (*shortcut_dropped) (EShortcutBar *shortcut_bar,
+ gint group_num,
+ gint position,
+ const gchar *item_url,
+ const char *item_name);
+
+ void (*shortcut_dragged) (EShortcutBar *shortcut_bar,
+ gint group_num,
+ gint item_num);
};