diff -C 1 old/launcher-dialog.c new/launcher-dialog.c *** old/launcher-dialog.c 2005-11-12 21:55:30.000000000 +0100 --- new/launcher-dialog.c 2005-11-12 20:52:02.000000000 +0100 *************** *** 51,52 **** --- 51,53 ---- GtkWidget *remove; + GtkWidget *first; *************** *** 811,812 **** --- 812,825 ---- gtk_widget_set_sensitive (ld->remove, TRUE); + gtk_widget_set_sensitive (ld->first, TRUE); + + /* Optional: disable sorting when "move to first" is enabled + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ld->first))) + { + gtk_widget_set_sensitive (ld->up, FALSE); + gtk_widget_set_sensitive (ld->down, FALSE); + } + */ + + if (ld->launcher->entries->len == 1) + gtk_widget_set_sensitive (ld->first, FALSE); *************** *** 836,837 **** --- 849,851 ---- gtk_widget_set_sensitive (ld->remove, FALSE); + gtk_widget_set_sensitive (ld->first, FALSE); } *************** *** 1151,1152 **** --- 1165,1173 ---- } + else if (b == ld->first) + { + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ld->first))) + ld->launcher->movefirst = TRUE; + else + ld->launcher->movefirst = FALSE; + } *************** *** 1156,1164 **** static void ! launcher_dialog_add_buttons (LauncherDialog *ld, GtkBox *box) { ! GtkWidget *hbox, *b, *align, *img; hbox = gtk_hbox_new (FALSE, BORDER); gtk_widget_show (hbox); ! gtk_box_pack_start (box, hbox, FALSE, FALSE, 0); --- 1177,1191 ---- static void ! launcher_dialog_add_buttons (LauncherDialog *ld, GtkBox *box, LauncherPlugin * launcher) { ! GtkWidget *hbox, *vbox, *b, *align, *img; ! GtkTooltips *tooltips; ! tooltips = gtk_tooltips_new (); + vbox = gtk_vbox_new (FALSE, BORDER); + gtk_widget_show (vbox); + gtk_box_pack_start (box, vbox, FALSE, FALSE, 0); + hbox = gtk_hbox_new (FALSE, BORDER); gtk_widget_show (hbox); ! gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); *************** *** 1212,1213 **** --- 1239,1250 ---- gtk_widget_set_sensitive (b, FALSE); + + b = ld->first = gtk_check_button_new_with_mnemonic (_("_Last used to 1st place")); + gtk_widget_show (b); + gtk_box_pack_start (GTK_BOX (vbox), b, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, b, _("Move the last used item to the first place in the list"), NULL); + + if (launcher->movefirst) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b), TRUE); + + g_signal_connect (b, "toggled", G_CALLBACK (tree_button_clicked), ld); } *************** *** 1302,1305 **** ! launcher_dialog_add_buttons (ld, GTK_BOX (vbox)); ! launcher_dialog_add_entry_properties (ld, GTK_BOX (hbox)); --- 1339,1342 ---- ! launcher_dialog_add_buttons (ld, GTK_BOX (vbox), launcher); ! launcher_dialog_add_entry_properties (ld, GTK_BOX (hbox)); diff -C 1 old/launcher.c new/launcher.c *** old/launcher.c 2005-11-12 21:55:30.000000000 +0100 --- new/launcher.c 2005-11-12 21:27:52.000000000 +0100 *************** *** 465,466 **** --- 465,504 ---- static void + launcher_move_to_first_place (LauncherEntry *entry) + { + if (entry->launcher->movefirst) + { + int i, j; + gboolean firstplace; + + for (j = 1; j < entry->launcher->entries->len; ++j) + { + for (i = 1; i < entry->launcher->entries->len; ++i) + { + LauncherEntry *tmp = + g_ptr_array_index (entry->launcher->entries, i); + + if (tmp == entry) + { + entry->launcher->entries->pdata[i] = + entry->launcher->entries->pdata[i-1]; + entry->launcher->entries->pdata[i-1] = tmp; + + if (i == 1) + { + firstplace = TRUE; + } + break; + } + } + + if (firstplace) + break; + } + + launcher_update_panel_entry (entry->launcher); + launcher_recreate_menu (entry->launcher); + } + } + + static void launcher_menu_item_activate (GtkWidget *mi, LauncherEntry *entry) *************** *** 468,469 **** --- 506,508 ---- launcher_entry_exec (gtk_widget_get_screen (mi), entry); + launcher_move_to_first_place (entry); } *************** *** 557,558 **** --- 596,599 ---- LauncherEntry *entry = g_ptr_array_index (launcher->entries, i); + + entry->launcher = launcher; *************** *** 860,861 **** --- 901,905 ---- + xfce_rc_set_group (rc, "Settings"); + launcher->movefirst = xfce_rc_read_bool_entry (rc, "MoveFirst", FALSE); + for (i = 0; i < 100 /* arbitrary */; ++i) *************** *** 930,931 **** --- 974,978 ---- + xfce_rc_set_group (rc, "Settings"); + xfce_rc_write_bool_entry (rc, "MoveFirst", launcher->movefirst); + for (i = 0; i < launcher->entries->len; ++i) diff -C 1 old/launcher.h new/launcher.h *** old/launcher.h 2005-11-12 21:55:30.000000000 +0100 --- new/launcher.h 2005-11-12 21:03:45.000000000 +0100 *************** *** 61,63 **** ! LauncherIcon icon; --- 61,64 ---- ! LauncherIcon icon; ! LauncherPlugin *launcher; *************** *** 70,71 **** --- 71,74 ---- GPtrArray *entries; + + guint movefirst:1;