From 9608c8843ed9d8f89d2929a1715e906f7e87cc35 Mon Sep 17 00:00:00 2001 From: John Sullivan Date: Wed, 17 May 2000 21:10:25 +0000 Subject: Started tweaking with the command buttons in the sidebar as a step towards hooking them into the final MIME API. * libnautilus-extensions/nautilus-mime-type.c: Removed verbs from display names, since we don't plan to support arbitrary verbs (i.e., alternate verbs to "Open") at least for this release. * src/ntl-index-panel.c: (add_command_buttons): Simplify code a little by using gtk_button_new_with_label; use "Open with" terminology; fix memory leak with command string stored in button. (nautilus_index_panel_update_info): Deleted obsolete comment. * src/ntl-window.c: (nautilus_window_load_content_view_menu): Added (currently insensitive) "View as ..." item to menu. --- src/nautilus-information-panel.c | 23 +++++++++++------------ src/nautilus-navigation-window.c | 9 +++++++++ src/nautilus-object-window.c | 9 +++++++++ src/nautilus-sidebar.c | 23 +++++++++++------------ src/nautilus-spatial-window.c | 9 +++++++++ src/nautilus-window.c | 9 +++++++++ src/ntl-index-panel.c | 23 +++++++++++------------ src/ntl-window.c | 9 +++++++++ 8 files changed, 78 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index ee26e461f..0adf24529 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -708,18 +708,16 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) { char *command_string, *temp_str; GList *p; - GtkWidget *temp_button, *temp_label; + GtkWidget *temp_button; NautilusCommandInfo *info; for (p = command_list; p != NULL; p = p->next) { info = p->data; index_panel->details->has_buttons = TRUE; - - temp_button = gtk_button_new (); - temp_label = gtk_label_new (info->display_name); - gtk_widget_show (temp_label); - gtk_container_add (GTK_CONTAINER (temp_button), temp_label); + + temp_str = g_strdup_printf (_("Open with %s"), info->display_name); + temp_button = gtk_button_new_with_label (temp_str); gtk_box_pack_start (GTK_BOX (index_panel->details->button_box), temp_button, FALSE, TRUE, 2); gtk_button_set_relief (GTK_BUTTON (temp_button), GTK_RELIEF_NORMAL); gtk_widget_set_usize (GTK_WIDGET (temp_button), 80, 20); @@ -730,9 +728,12 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) command_string = g_strdup_printf (info->command_string, temp_str); g_free(temp_str); - - gtk_signal_connect (GTK_OBJECT (temp_button), "clicked", - GTK_SIGNAL_FUNC (command_button_cb), command_string); + + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (temp_button), + "clicked", + GTK_SIGNAL_FUNC (command_button_cb), + command_string); gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel); gtk_widget_show (temp_button); @@ -840,9 +841,7 @@ nautilus_index_panel_update_info (NautilusIndexPanel *index_panel, nautilus_index_title_set_uri (index_panel->details->title, index_panel->details->uri, initial_title); - - /* add keywords if we got any */ - + /* set up the command buttons */ nautilus_index_panel_update_buttons (index_panel); } diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 47f43eddb..773634e3a 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -729,6 +729,15 @@ nautilus_window_load_content_view_menu (NautilusWindow *window, ++index; } + + /* Add "View as ..." extra bonus choice, with separator before it. */ + menu_item = gtk_menu_item_new (); + gtk_widget_show (menu_item); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + menu_item = gtk_menu_item_new_with_label (_("View as ...")); + gtk_widget_show (menu_item); + gtk_widget_set_sensitive (menu_item, FALSE); /* doesn't do anything yet */ + gtk_menu_append (GTK_MENU (new_menu), menu_item); /* * We create and attach a new menu here because adding/removing diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index 47f43eddb..773634e3a 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -729,6 +729,15 @@ nautilus_window_load_content_view_menu (NautilusWindow *window, ++index; } + + /* Add "View as ..." extra bonus choice, with separator before it. */ + menu_item = gtk_menu_item_new (); + gtk_widget_show (menu_item); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + menu_item = gtk_menu_item_new_with_label (_("View as ...")); + gtk_widget_show (menu_item); + gtk_widget_set_sensitive (menu_item, FALSE); /* doesn't do anything yet */ + gtk_menu_append (GTK_MENU (new_menu), menu_item); /* * We create and attach a new menu here because adding/removing diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index ee26e461f..0adf24529 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -708,18 +708,16 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) { char *command_string, *temp_str; GList *p; - GtkWidget *temp_button, *temp_label; + GtkWidget *temp_button; NautilusCommandInfo *info; for (p = command_list; p != NULL; p = p->next) { info = p->data; index_panel->details->has_buttons = TRUE; - - temp_button = gtk_button_new (); - temp_label = gtk_label_new (info->display_name); - gtk_widget_show (temp_label); - gtk_container_add (GTK_CONTAINER (temp_button), temp_label); + + temp_str = g_strdup_printf (_("Open with %s"), info->display_name); + temp_button = gtk_button_new_with_label (temp_str); gtk_box_pack_start (GTK_BOX (index_panel->details->button_box), temp_button, FALSE, TRUE, 2); gtk_button_set_relief (GTK_BUTTON (temp_button), GTK_RELIEF_NORMAL); gtk_widget_set_usize (GTK_WIDGET (temp_button), 80, 20); @@ -730,9 +728,12 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) command_string = g_strdup_printf (info->command_string, temp_str); g_free(temp_str); - - gtk_signal_connect (GTK_OBJECT (temp_button), "clicked", - GTK_SIGNAL_FUNC (command_button_cb), command_string); + + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (temp_button), + "clicked", + GTK_SIGNAL_FUNC (command_button_cb), + command_string); gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel); gtk_widget_show (temp_button); @@ -840,9 +841,7 @@ nautilus_index_panel_update_info (NautilusIndexPanel *index_panel, nautilus_index_title_set_uri (index_panel->details->title, index_panel->details->uri, initial_title); - - /* add keywords if we got any */ - + /* set up the command buttons */ nautilus_index_panel_update_buttons (index_panel); } diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 47f43eddb..773634e3a 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -729,6 +729,15 @@ nautilus_window_load_content_view_menu (NautilusWindow *window, ++index; } + + /* Add "View as ..." extra bonus choice, with separator before it. */ + menu_item = gtk_menu_item_new (); + gtk_widget_show (menu_item); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + menu_item = gtk_menu_item_new_with_label (_("View as ...")); + gtk_widget_show (menu_item); + gtk_widget_set_sensitive (menu_item, FALSE); /* doesn't do anything yet */ + gtk_menu_append (GTK_MENU (new_menu), menu_item); /* * We create and attach a new menu here because adding/removing diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 47f43eddb..773634e3a 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -729,6 +729,15 @@ nautilus_window_load_content_view_menu (NautilusWindow *window, ++index; } + + /* Add "View as ..." extra bonus choice, with separator before it. */ + menu_item = gtk_menu_item_new (); + gtk_widget_show (menu_item); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + menu_item = gtk_menu_item_new_with_label (_("View as ...")); + gtk_widget_show (menu_item); + gtk_widget_set_sensitive (menu_item, FALSE); /* doesn't do anything yet */ + gtk_menu_append (GTK_MENU (new_menu), menu_item); /* * We create and attach a new menu here because adding/removing diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c index ee26e461f..0adf24529 100644 --- a/src/ntl-index-panel.c +++ b/src/ntl-index-panel.c @@ -708,18 +708,16 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) { char *command_string, *temp_str; GList *p; - GtkWidget *temp_button, *temp_label; + GtkWidget *temp_button; NautilusCommandInfo *info; for (p = command_list; p != NULL; p = p->next) { info = p->data; index_panel->details->has_buttons = TRUE; - - temp_button = gtk_button_new (); - temp_label = gtk_label_new (info->display_name); - gtk_widget_show (temp_label); - gtk_container_add (GTK_CONTAINER (temp_button), temp_label); + + temp_str = g_strdup_printf (_("Open with %s"), info->display_name); + temp_button = gtk_button_new_with_label (temp_str); gtk_box_pack_start (GTK_BOX (index_panel->details->button_box), temp_button, FALSE, TRUE, 2); gtk_button_set_relief (GTK_BUTTON (temp_button), GTK_RELIEF_NORMAL); gtk_widget_set_usize (GTK_WIDGET (temp_button), 80, 20); @@ -730,9 +728,12 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) command_string = g_strdup_printf (info->command_string, temp_str); g_free(temp_str); - - gtk_signal_connect (GTK_OBJECT (temp_button), "clicked", - GTK_SIGNAL_FUNC (command_button_cb), command_string); + + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (temp_button), + "clicked", + GTK_SIGNAL_FUNC (command_button_cb), + command_string); gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel); gtk_widget_show (temp_button); @@ -840,9 +841,7 @@ nautilus_index_panel_update_info (NautilusIndexPanel *index_panel, nautilus_index_title_set_uri (index_panel->details->title, index_panel->details->uri, initial_title); - - /* add keywords if we got any */ - + /* set up the command buttons */ nautilus_index_panel_update_buttons (index_panel); } diff --git a/src/ntl-window.c b/src/ntl-window.c index 47f43eddb..773634e3a 100644 --- a/src/ntl-window.c +++ b/src/ntl-window.c @@ -729,6 +729,15 @@ nautilus_window_load_content_view_menu (NautilusWindow *window, ++index; } + + /* Add "View as ..." extra bonus choice, with separator before it. */ + menu_item = gtk_menu_item_new (); + gtk_widget_show (menu_item); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + menu_item = gtk_menu_item_new_with_label (_("View as ...")); + gtk_widget_show (menu_item); + gtk_widget_set_sensitive (menu_item, FALSE); /* doesn't do anything yet */ + gtk_menu_append (GTK_MENU (new_menu), menu_item); /* * We create and attach a new menu here because adding/removing -- cgit v1.2.1