aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/shortcut-bar
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2000-09-30 23:17:12 +0800
committerDamon Chaplin <damon@src.gnome.org>2000-09-30 23:17:12 +0800
commit3f23fba5e0ed7efd438c57db2e2e6ae30c7cdaa1 (patch)
tree9d58f7f4ddda2cddf31ae57d9d10c52465891d4c /widgets/shortcut-bar
parent024c4bee0a0c289ae6f9ad2d5b9370df10ce291b (diff)
downloadgsoc2013-evolution-3f23fba5e0ed7efd438c57db2e2e6ae30c7cdaa1.tar.gz
gsoc2013-evolution-3f23fba5e0ed7efd438c57db2e2e6ae30c7cdaa1.tar.zst
gsoc2013-evolution-3f23fba5e0ed7efd438c57db2e2e6ae30c7cdaa1.zip
updated to use new EShortcutBar signals for DnD.
2000-09-30 Damon Chaplin <damon@helixcode.com> * test-shortcut-bar.c: updated to use new EShortcutBar signals for DnD. * e-group-bar.c (e_group_bar_add_group): show the new windows if the EGroupBar is realized, handle the position argument properly, and fixed the window z-order code. * e-shortcut-bar.c (e_shortcut_bar_add_group): pass group_num to the e_group_bar_add_group() function. * e-icon-bar-bg-item.c (e_icon_bar_bg_item_draw): fixed SEGV when trying to drag into a group with no items. svn path=/trunk/; revision=5643
Diffstat (limited to 'widgets/shortcut-bar')
-rw-r--r--widgets/shortcut-bar/ChangeLog14
-rw-r--r--widgets/shortcut-bar/e-group-bar.c20
-rw-r--r--widgets/shortcut-bar/e-icon-bar-bg-item.c22
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.c2
-rw-r--r--widgets/shortcut-bar/test-shortcut-bar.c54
5 files changed, 98 insertions, 14 deletions
diff --git a/widgets/shortcut-bar/ChangeLog b/widgets/shortcut-bar/ChangeLog
index 58b315d2a8..088eed7ea3 100644
--- a/widgets/shortcut-bar/ChangeLog
+++ b/widgets/shortcut-bar/ChangeLog
@@ -1,3 +1,17 @@
+2000-09-30 Damon Chaplin <damon@helixcode.com>
+
+ * test-shortcut-bar.c: updated to use new EShortcutBar signals for DnD.
+
+ * e-group-bar.c (e_group_bar_add_group): show the new windows if the
+ EGroupBar is realized, handle the position argument properly, and
+ fixed the window z-order code.
+
+ * e-shortcut-bar.c (e_shortcut_bar_add_group): pass group_num to the
+ e_group_bar_add_group() function.
+
+ * e-icon-bar-bg-item.c (e_icon_bar_bg_item_draw): fixed SEGV when
+ trying to drag into a group with no items.
+
2000-09-28 Ettore Perazzoli <ettore@helixcode.com>
* e-shortcut-bar.c (e_shortcut_bar_destroy): Disconnect the model
diff --git a/widgets/shortcut-bar/e-group-bar.c b/widgets/shortcut-bar/e-group-bar.c
index dd78fe6243..b5aa471d0e 100644
--- a/widgets/shortcut-bar/e-group-bar.c
+++ b/widgets/shortcut-bar/e-group-bar.c
@@ -914,8 +914,11 @@ e_group_bar_add_group (EGroupBar *group_bar,
/* Append an empty group to the children array and get a pointer to
it, so we can use it like a normal group. */
- group_num = group_bar->children->len;
- g_array_append_val (group_bar->children, empty_group);
+ if (position == -1)
+ group_num = group_bar->children->len;
+ else
+ group_num = position;
+ g_array_insert_val (group_bar->children, group_num, empty_group);
group = &g_array_index (group_bar->children,
EGroupBarChild, group_num);
@@ -929,26 +932,32 @@ e_group_bar_add_group (EGroupBar *group_bar,
group->button_window_target_y = 0;
group->child_window_target_y = 0;
- /* If we don't have a current group, set it to the first one. */
+ /* If we don't have a current group, set it to the first one.
+ Move the currently shown group index forward if necessary. */
if (group_bar->current_group_num == -1)
group_bar->current_group_num = 0;
+ else if (group_bar->current_group_num >= group_num)
+ group_bar->current_group_num++;
/* If the EGroupBar widget is realize, we need to create the child
windows to put the button & child in. */
if (GTK_WIDGET_REALIZED (group_bar)) {
e_group_bar_create_group_button_window (group_bar, group_num);
+ gdk_window_show (group->button_window);
+
e_group_bar_create_group_child_window (group_bar, group_num);
+ gdk_window_show (group->child_window);
/* We need to lower all the child windows of the previous
groups, in reverse order, to keep the stacking order
correct. */
- for (tmp_group_num = group_num - 1;
+ for (tmp_group_num = group_num;
tmp_group_num >= 0;
tmp_group_num--) {
tmp_group = &g_array_index (group_bar->children,
EGroupBarChild,
tmp_group_num);
- gdk_window_lower (group->child_window);
+ gdk_window_lower (tmp_group->child_window);
}
}
@@ -1136,6 +1145,7 @@ e_group_bar_set_current_group_num (EGroupBar *group_bar,
/* The positions will be sorted out when the widget's size is
allocated. */
group_bar->current_group_num = group_num;
+ gtk_widget_queue_resize (GTK_WIDGET (group_bar));
}
}
diff --git a/widgets/shortcut-bar/e-icon-bar-bg-item.c b/widgets/shortcut-bar/e-icon-bar-bg-item.c
index 5154a38267..26da038a6e 100644
--- a/widgets/shortcut-bar/e-icon-bar-bg-item.c
+++ b/widgets/shortcut-bar/e-icon-bar-bg-item.c
@@ -234,15 +234,23 @@ e_icon_bar_bg_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable,
bar_y = 0;
} else {
/* We need to draw the bar after the last item. */
- item = &g_array_index (icon_bar->items, EIconBarItem,
- icon_bar->items->len - 1);
- bar_y = item->item_height + icon_bar->spacing;
+ if (icon_bar->items->len != 0) {
+ item = &g_array_index (icon_bar->items,
+ EIconBarItem,
+ icon_bar->items->len - 1);
+ bar_y = item->item_height + icon_bar->spacing;
+ } else {
+ item = NULL;
+ bar_y = icon_bar->spacing;
+ }
}
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- bar_y += item->icon_y;
- } else {
- bar_y += MIN (item->icon_y, item->text_y);
+ if (item) {
+ if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
+ bar_y += item->icon_y;
+ } else {
+ bar_y += MIN (item->icon_y, item->text_y);
+ }
}
bar_y -= y + icon_bar->spacing / 2;
diff --git a/widgets/shortcut-bar/e-shortcut-bar.c b/widgets/shortcut-bar/e-shortcut-bar.c
index 2c15d499d2..0e577c9207 100644
--- a/widgets/shortcut-bar/e-shortcut-bar.c
+++ b/widgets/shortcut-bar/e-shortcut-bar.c
@@ -452,7 +452,7 @@ e_shortcut_bar_add_group (EShortcutBar *shortcut_bar,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
e_group_bar_add_group (E_GROUP_BAR (shortcut_bar),
- group->vscrolled_bar, button, -1);
+ group->vscrolled_bar, button, group_num);
gtk_widget_pop_visual ();
gtk_widget_pop_colormap ();
diff --git a/widgets/shortcut-bar/test-shortcut-bar.c b/widgets/shortcut-bar/test-shortcut-bar.c
index aafb54ccb0..4eb5e4c199 100644
--- a/widgets/shortcut-bar/test-shortcut-bar.c
+++ b/widgets/shortcut-bar/test-shortcut-bar.c
@@ -73,6 +73,8 @@ static void set_large_icons (GtkWidget *menuitem,
EShortcutBar *shortcut_bar);
static void set_small_icons (GtkWidget *menuitem,
EShortcutBar *shortcut_bar);
+static void add_group (GtkWidget *menuitem,
+ EShortcutBar *shortcut_bar);
static void remove_group (GtkWidget *menuitem,
EShortcutBar *shortcut_bar);
@@ -94,6 +96,14 @@ static void on_group_added (EShortcutModel *shortcut_model,
gint group_num);
static void on_group_removed (EShortcutModel *shortcut_model,
gint group_num);
+static void on_shortcut_dragged (EShortcutBar *shortcut_bar,
+ gint group_num,
+ gint item_num);
+static void on_shortcut_dropped (EShortcutBar *shortcut_bar,
+ gint group_num,
+ gint item_num,
+ gchar *url,
+ gchar *name);
int
main (int argc, char *argv[])
@@ -139,6 +149,11 @@ main (int argc, char *argv[])
gtk_signal_connect (GTK_OBJECT (shortcut_model), "group_removed",
GTK_SIGNAL_FUNC (on_group_removed), NULL);
+ gtk_signal_connect (GTK_OBJECT (shortcut_bar), "shortcut_dragged",
+ GTK_SIGNAL_FUNC (on_shortcut_dragged), NULL);
+ gtk_signal_connect (GTK_OBJECT (shortcut_bar), "shortcut_dropped",
+ GTK_SIGNAL_FUNC (on_shortcut_dropped), NULL);
+
#if 0
gtk_container_set_border_width (GTK_CONTAINER (shortcut_bar), 4);
#endif
@@ -339,9 +354,10 @@ show_standard_popup (EShortcutBar *shortcut_bar,
gtk_menu_append (GTK_MENU (menu), menuitem);
menuitem = gtk_menu_item_new_with_label ("Add New Group");
- gtk_widget_set_sensitive (menuitem, FALSE);
gtk_widget_show (menuitem);
gtk_menu_append (GTK_MENU (menu), menuitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (add_group), shortcut_bar);
menuitem = gtk_menu_item_new_with_label ("Remove Group");
gtk_widget_show (menuitem);
@@ -421,6 +437,14 @@ set_small_icons (GtkWidget *menuitem,
static void
+add_group (GtkWidget *menuitem,
+ EShortcutBar *shortcut_bar)
+{
+ e_shortcut_model_add_group (shortcut_bar->model, 3, "New Group");
+}
+
+
+static void
remove_group (GtkWidget *menuitem,
EShortcutBar *shortcut_bar)
{
@@ -604,3 +628,31 @@ on_group_removed (EShortcutModel *shortcut_model,
{
g_print ("In on_group_removed Group:%i\n", group_num);
}
+
+
+static void
+on_shortcut_dragged (EShortcutBar *shortcut_bar,
+ gint group_num,
+ gint item_num)
+{
+ g_print ("In on_shortcut_dragged Group:%i Item:%i\n", group_num,
+ item_num);
+
+ e_shortcut_model_remove_item (shortcut_bar->model, group_num,
+ item_num);
+}
+
+
+static void
+on_shortcut_dropped (EShortcutBar *shortcut_bar,
+ gint group_num,
+ gint item_num,
+ gchar *url,
+ gchar *name)
+{
+ g_print ("In on_shortcut_dropped Group:%i Item:%i\n", group_num,
+ item_num);
+
+ e_shortcut_model_add_item (shortcut_bar->model,
+ group_num, item_num, url, name);
+}
44/cgit/cgit.cgi/freebsd-ports-gnome/commit/?h=mate-1.22&id=29b4a52cba40680926a666438e1db30fee5c01b7'>Update to 1.9.1.marcus2003-05-129-6/+9 * Upgrade to 2.4.obraun2003-05-122-2/+2 * Upgrade to 0.4.4.obraun2003-05-123-55/+5 * Upgrade to 2.4.0, which introduces, amongs other new features, IPv6des2003-05-128-158/+222 * Update to 0.20.2.nork2003-05-122-2/+2 * Update to a current version.joerg2003-05-122-2/+2 * Update to 0.19, and Unmark BROKEN on 4-STABLE(re-supported 5.005).nork2003-05-122-13/+3 * o Remove dependency on x11-toolkits/fltk-xunicode by retire.nork2003-05-121-8/+4 * Update to 0.0.19.knu2003-05-122-2/+2 * Update this suite to a current snapshot of gcc 3.3. Quite a few AVR-relatedjoerg2003-05-126-116/+18 * This module does not yet work properly on sparc64.knu2003-05-121-0/+2 * Unlink fltk-xunicode.knu2003-05-121-1/+0 * Retire fltk-xunicode since the maintenance had been discontinued.knu2003-05-123-18/+1 * upgrade to 0.1.7ijliao2003-05-128-64/+42 * Update to 0.8lioux2003-05-1212-34/+88 * Update to 1.4.4.marcus2003-05-124-8/+21 * * Add dependecy on devel/p5-File-Temp.obraun2003-05-121-1/+3 * Update to 2.0.11.marcus2003-05-122-3/+2 * - fix permissions on installed filespetef2003-05-122-10/+18 * - Don't do two read()s, we're not on windows and don't have a \r to strippetef2003-05-122-0/+22 * Comment out code when building in 5.x FreeBSD branch when using gcclioux2003-05-123-0/+57 * Require perl 5.6.1.petef2003-05-121-1/+7 * igal --> ports/www/igalpetef2003-05-121-0/+1 * Add igal 1.3, a static html image gallery generator for *nix.petef2003-05-128-0/+122 * - update to 0.4petef2003-05-114-295/+2 * - update to 2.28petef2003-05-118-86/+90 * - update to 1.1.4.b3petef2003-05-117-41/+36 * pflogstats --> ports/mail/pflogstatspetef2003-05-111-0/+1 * Add pflogstats 20030404, postfix Log Statistics Reporter.petef2003-05-115-0/+67 * Fix broken LaTeX code generated by doxygen. Changing packagejoerg2003-05-112-1/+12 * Update this port to include some manpages that were missing from thecracauer2003-05-112-3/+21 * Update to version 0.93.0314 and unbreak.olgeni2003-05-116-100/+911 * Use new master site.cracauer2003-05-111-2/+2 * Update to dvts-patch-20030511.simokawa2003-05-112-2/+3 * Fix patch after recent tin port update.demon2003-05-111-2/+2 * Reset maintainer to ports@ since rsync is not written in Haskell ;o)obraun2003-05-111-1/+1 * Workaround to fix build on ia64. I hope it fixes the problem.ume2003-05-115-0/+75 * Include <stdlib.h> for malloc() prototypeache2003-05-112-0/+12 * Make it buildable on non-x86 machines.edwin2003-05-111-0/+19 * Update to astime-2.8kris2003-05-112-2/+2 * Update to adzap-20030505kris2003-05-112-2/+2 * - use acroread5 port instead of old ancient acroread (v3) for port dependency,andreas2003-05-113-3/+16 * - allow build with more warnings enabled, NO_WERROR=yesdinoex2003-05-112-0/+10 * - extend MASTER_SITESdinoex2003-05-111-0/+1 * - update to 2.9.8dinoex2003-05-1121-105/+30 * Remove a '/' in front of the README in the plist that was preventing themarcus2003-05-111-1/+1 * Add a patch to allow -lc_r to be linked in on -CURRENT. Not having this causedmarcus2003-05-112-0/+52 * Update to xprobe 0.0.2 and drop maintainershipkris2003-05-114-35/+18 * Update to snortsnarf 021111.1kris2003-05-112-2/+2 * Unmark BROKEN: 5.x branch after OSVERSION 500041 has getopt_long.lioux2003-05-111-3/+10 * Only apply the PTHREAD_LIBS fix to 5.x branchlioux2003-05-111-2/+2 * Fix small typo: sed recipy should be 's|before|after|', notlioux2003-05-111-1/+1 * o For some reason configure is not propagating PTHREAD_LIBS to thelioux2003-05-111-2/+9 * Fix a nibble calculation bug for IPv6 in nslookup.dougb2003-05-112-0/+40 * Unmark BROKEN by fixing PLIST. According to bento logs, the errorlioux2003-05-112-3/+4 * o Fix typo: use PKGNAMESUFFIX for naming destination directorieslioux2003-05-111-2/+3 * - unbreak: fix pkg-install not to create a /usr/interbase symlinkpetef2003-05-1115-90/+50 * Attent to bento cluster peculiar behavior: it is prefixing thelioux2003-05-112-2/+4 * xmms-cdparanoia --> ports/audio/xmms-cdparanoiapetef2003-05-111-0/+1 * Add xmms-cdparanoia 0.1, cdparanoia plugin for XMMS.petef2003-05-115-0/+39 * o Do not check return of dlerror(3) to see if there was an error.lioux2003-05-112-0/+12 * Fix build on alpha ARCHlioux2003-05-112-14/+22 * Fix fetching: correct MASTER_SITE_SUBDIRlioux2003-05-111-1/+1 * Add specific handling of and appropriate dependences forlioux2003-05-113-3/+26 * Update to 2.3.10.petef2003-05-1110-8/+106 * Update to 1.1.adamw2003-05-113-4/+9 * Update to 1.10.0.petef2003-05-113-2/+4 * - update to 1.9.1ipetef2003-05-116-9/+9 * - update to a working master sitepetef2003-05-112-13/+4 * Variable subst must be %% quoted on both sides.alfred2003-05-111-1/+1 * Update to 0.9.adamw2003-05-114-13/+12 * - Remove the obsolete WWW url. [1]perky2003-05-112-1/+1 * Upgrade to 5.0 and keep 4.0 as lang/lua4perky2003-05-1113-112/+71 * Change maintainership to submitter.nork2003-05-111-1/+1 * wxGlade --> ports/devel/wxGladepetef2003-05-111-0/+1 * Add wxGlade 0.2.1, GUI builder for wxPython/wxWindows written inpetef2003-05-115-0/+256 * - update to 1.0.0petef2003-05-1115-132/+384 * The port is still BROKEN, but the distfile is fetchable now.petef2003-05-111-1/+1 * Despite this port having IGNORE set, update to a valid master site.petef2003-05-111-1/+1 * trm --> ports/audio/trmpetef2003-05-111-0/+1 * Add trm 0.2.1, TRM generator to generate acoustic fingerprints.petef2003-05-115-0/+43 * Update mesagl to 5.0.1 after a repo-copy from Mesa3 and connect itsobomax2003-05-1111-50/+119 * The distfile is now in it's own versioned subdir.petef2003-05-111-1/+1 * ftp.inria.fr was rearranged; update MASTER_SITES.petef2003-05-111-1/+1 * Unbreak by depending on gtk20arved2003-05-101-3/+1 * Master site has moved, add a backup too.petef2003-05-101-1/+2 * Master site has moved.petef2003-05-101-1/+1 * py-yaml development has been taken over by someone else; update WWW:petef2003-05-101-1/+1 * catch up with news/tin and unbreak zh-tin-1.5.17leeym2003-05-101-9/+9 * py-log4py's homepage changed URLs.petef2003-05-101-1/+1 * Unbreak: update to 1.1.25.petef2003-05-106-18/+58 * py-istring's homepage changed URLs.petef2003-05-101-1/+1 * - unbreak: update to 1.7.1, which is fetchablepetef2003-05-103-9/+6 * - update COMMENT to be more descriptivepetef2003-05-101-13/+11