more work on the menu code -- hooking it up to actual code so it

works is a vast improvement.
This commit is contained in:
Jonathan Blandford 1998-12-30 00:19:46 +00:00
parent 2d88b3d90b
commit 282e95805b
3 changed files with 166 additions and 16 deletions

View File

@ -22,6 +22,15 @@
#include "layout.h"
#include "../vfs/vfs.h"
static enum {
SORT_NAME,
SORT_EXTENSION,
SORT_ACCESS,
SORT_MODIFY,
SORT_CHANGE,
SORT_SIZE
} SortOrderCode;
void
gnome_listing_cmd (GtkWidget *widget, WPanel *panel)
{
@ -131,3 +140,128 @@ gnome_close_panel (GtkWidget *widget, WPanel *panel)
return TRUE;
}
void
gnome_icon_view_cmd (GtkWidget *widget, WPanel *panel)
{
if (panel->list_type == list_icons)
return;
panel->list_type = list_icons;
set_panel_formats (panel);
paint_panel (panel);
do_refresh ();
}
void
gnome_partial_view_cmd (GtkWidget *widget, WPanel *panel)
{
if (panel->list_type == list_brief)
return;
panel->list_type = list_brief;
set_panel_formats (panel);
paint_panel (panel);
do_refresh ();
}
void
gnome_full_view_cmd (GtkWidget *widget, WPanel *panel)
{
if (panel->list_type == list_full)
return;
panel->list_type = list_full;
set_panel_formats (panel);
paint_panel (panel);
do_refresh ();
}
void
gnome_custom_view_cmd (GtkWidget *widget, WPanel *panel)
{
if (panel->list_type == list_user)
return;
panel->list_type = list_user;
set_panel_formats (panel);
paint_panel (panel);
do_refresh ();
}
static void
option_menu_sort_callback(GtkWidget *widget, gpointer data)
{
switch ((gint) data) {
case SORT_NAME:
break;
case SORT_EXTENSION:
break;
case SORT_ACCESS:
break;
case SORT_MODIFY:
break;
case SORT_CHANGE:
break;
case SORT_SIZE:
break;
}
}
void
gnome_sort_cmd (GtkWidget *widget, WPanel *panel)
/* Helps you determine the order in which the files exist. */
{
GtkWidget *sort_box;
GtkWidget *hbox;
GtkWidget *omenu;
GtkWidget *menu;
GtkWidget *menu_item;
GtkWidget *cbox;
sort_box = gnome_dialog_new ("Sort By", GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL, NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox), hbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new ("Sort files by "), FALSE, FALSE, 0);
omenu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
menu = gtk_menu_new ();
menu_item = gtk_menu_item_new_with_label ( _("Name"));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_NAME);
menu_item = gtk_menu_item_new_with_label ( _("File Type"));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_EXTENSION);
menu_item = gtk_menu_item_new_with_label ( _("Size"));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_SIZE);
menu_item = gtk_menu_item_new_with_label ( _("Time Last Accessed"));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_ACCESS);
menu_item = gtk_menu_item_new_with_label ( _("Time Last Modified"));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_MODIFY);
menu_item = gtk_menu_item_new_with_label ( _("Time Last Changed"));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_CHANGE);
gtk_widget_show_all (menu);
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
cbox = gtk_check_button_new_with_label (N_("Reverse the order."));
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox),
cbox, FALSE, FALSE, 0);
cbox = gtk_check_button_new_with_label (N_("Ignore case sensitivity."));
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox),
cbox, FALSE, FALSE, 0);
/* off to the races */
gtk_widget_show_all (GNOME_DIALOG (sort_box)->vbox);
gnome_dialog_run (GNOME_DIALOG (sort_box));
/* Reverse order */
/* case sensitive */
}

View File

@ -8,5 +8,9 @@ void gnome_about_cmd (void);
void gnome_quit_cmd (void);
void gnome_open_panel (GtkWidget *widget, WPanel *panel);
int gnome_close_panel (GtkWidget *widget, WPanel *panel);
void gnome_icon_view_cmd (GtkWidget *widget, WPanel *panel);
void gnome_partial_view_cmd (GtkWidget *widget, WPanel *panel);
void gnome_full_view_cmd (GtkWidget *widget, WPanel *panel);
void gnome_custom_view_cmd (GtkWidget *widget, WPanel *panel);
void gnome_sort_cmd (GtkWidget *widget, WPanel *panel);
#endif /* __GCMD_H */

View File

@ -266,23 +266,33 @@ GtkCheckMenuItem *gnome_toggle_snap (void);
GnomeUIInfo gnome_panel_file_menu [] = {
{ GNOME_APP_UI_ITEM, N_("_New window"), N_("Opens a new window"), gnome_open_panel },
#if 0
/* We want to make a new menu entry here... */
#endif
{ GNOME_APP_UI_SEPARATOR },
{ GNOME_APP_UI_ITEM, N_("_Open"), N_("Open selected files"), NULL },
{ GNOME_APP_UI_ITEM, N_("_Copy..."), N_("Copy files"), copy_cmd },
/* For example: */
/* New-> */
/* Command Prompt */
/* Gimp Image */
/* Gnumeric Spreadsheet */
/* Text Document */
/* etc... */
{ GNOME_APP_UI_SEPARATOR },
{ GNOME_APP_UI_ITEM, N_("_Open"), N_("Open selected files"), NULL, NULL,
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN },
{ GNOME_APP_UI_ITEM, N_("_Copy..."), N_("Copy files"), copy_cmd, NULL},
{ GNOME_APP_UI_ITEM, N_("_Move..."), N_("Rename or move files"), ren_cmd },
{ GNOME_APP_UI_ITEM, N_("_Delete..."), N_("Delete files from disk"), delete_cmd },
{ GNOME_APP_UI_SEPARATOR },
{ GNOME_APP_UI_ITEM, N_("C_lose"), N_("Close this panel"), gnome_close_panel },
{ GNOME_APP_UI_ITEM, N_("C_lose"), N_("Close this panel"), gnome_close_panel, NULL,
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CLOSE },
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
};
GnomeUIInfo gnome_panel_edit_menu [] = {
{ GNOME_APP_UI_ITEM, N_("_Cut"), N_("Cuts the selected files into the cut buffer."), NULL },
{ GNOME_APP_UI_ITEM, N_("C_opy"), N_("Copies the selected files into the cut buffer."), NULL },
{ GNOME_APP_UI_ITEM, N_("_Paste"), N_("Pastes files from the cut buffer into the current directory"), NULL },
{ GNOME_APP_UI_ITEM, N_("_Cut"), N_("Cuts the selected files into the cut buffer."), NULL, NULL,
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CUT },
{ GNOME_APP_UI_ITEM, N_("C_opy"), N_("Copies the selected files into the cut buffer."), NULL, NULL,
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_COPY },
{ GNOME_APP_UI_ITEM, N_("_Paste"), N_("Pastes files from the cut buffer into the current directory"), NULL, NULL,
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PASTE },
{ GNOME_APP_UI_SEPARATOR },
{ GNOME_APP_UI_ITEM, N_("_Select Files..."), N_("Select a group of files"), select_cmd },
{ GNOME_APP_UI_ITEM, N_("_Invert Selection"), N_("Reverses the list of tagged files"), reverse_selection_cmd },
@ -294,16 +304,16 @@ GnomeUIInfo gnome_panel_edit_menu [] = {
};
GnomeUIInfo gnome_panel_view_menu [] = {
{ GNOME_APP_UI_ITEM, N_("Icon View"), NULL, NULL},
{ GNOME_APP_UI_ITEM, N_("Partial View"), NULL, NULL},
{ GNOME_APP_UI_ITEM, N_("Full View"), NULL, NULL},
{ GNOME_APP_UI_ITEM, N_("Custom View"), NULL, NULL},
{ GNOME_APP_UI_ITEM, N_("Icon View"), NULL, gnome_icon_view_cmd, NULL},
{ GNOME_APP_UI_ITEM, N_("Partial View"), NULL, gnome_partial_view_cmd, NULL},
{ GNOME_APP_UI_ITEM, N_("Full View"), NULL, gnome_full_view_cmd, NULL},
{ GNOME_APP_UI_ITEM, N_("Custom View"), NULL, gnome_custom_view_cmd, NULL},
{GNOME_APP_UI_ENDOFINFO, NULL, NULL, NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL}
};
GnomeUIInfo gnome_panel_layout_menu [] = {
{ GNOME_APP_UI_ITEM, N_("_Sort Order..."), N_("Confirmation settings"), sort_cmd },
{ GNOME_APP_UI_ITEM, N_("_Sort By..."), N_("Confirmation settings"), gnome_sort_cmd },
{ GNOME_APP_UI_ITEM, N_("_Filter View..."), N_("Global option settings"), NULL },
{ GNOME_APP_UI_SEPARATOR },
{ GNOME_APP_UI_RADIOITEMS, NULL , NULL, gnome_panel_view_menu},
@ -311,7 +321,9 @@ GnomeUIInfo gnome_panel_layout_menu [] = {
};
GnomeUIInfo gnome_panel_commands_menu [] = {
{ GNOME_APP_UI_ITEM, N_("_Find File..."), N_("Locate files on disk"), find_cmd },
{ GNOME_APP_UI_ITEM, N_("_Find File..."), N_("Locate files on disk"), find_cmd, NULL,
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_JUMP_TO},
{ GNOME_APP_UI_ITEM, N_("_Compare panels..."), N_("Compare two panel contents"), gnome_compare_panels },
{ GNOME_APP_UI_ITEM, N_("_Run Command..."), N_("Run a command and put the results in a panel"), external_panelize },
#ifdef USE_VFS