Commit 10272ff6 authored by Andy Hertzfeld's avatar Andy Hertzfeld

finished hit-testing and made it activate the appropriate metaview when


       finished hit-testing and made it activate the appropriate metaview
       when the corresponding tab is clicked
parent d01ee0fa
2000-02-09 Andy Hertzfeld <andy@eazel.com>
completed hit-testing and activation for the index tabs. They're
usable now, but I'm leaving them off until they're more refined
* src/nautilus-index-tabs.c:
completed hit-testing
* src/ntl-index-panel.c:
activate the appropriate metaview when the corresponding tab is clicked
2000-02-09 Andy Hertzfeld <andy@eazel.com> 2000-02-09 Andy Hertzfeld <andy@eazel.com>
more work on the index panel, still conditionally disabled; more work on the index panel, still conditionally disabled;
change USE_NEW_TABS to a non-zero value if you want to check it out change USE_NEW_TABS to a non-zero value if you want to check it out
src/nautilus-index-tabs.c,h: * src/nautilus-index-tabs.c,h:
improved positioning and started on hit-testing improved positioning and started on hit-testing
src/ntl-index-panel.c: * src/ntl-index-panel.c:
made the notebook hidden by default and added hit-testing infrastructure made the notebook hidden by default and added hit-testing infrastructure
src/nautilus-zoom-control.c: * src/nautilus-zoom-control.c:
fixed incorrect comment fixed incorrect comment
2000-02-09 Darin Adler <darin@eazel.com> 2000-02-09 Darin Adler <darin@eazel.com>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* *
*/ */
#include <math.h>
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtkwidget.h> #include <gtk/gtkwidget.h>
#include <gnome.h> #include <gnome.h>
...@@ -63,6 +64,7 @@ static void nautilus_index_tabs_class_init (NautilusIndexTabsClass *klass); ...@@ -63,6 +64,7 @@ static void nautilus_index_tabs_class_init (NautilusIndexTabsClass *klass);
static void nautilus_index_tabs_init (NautilusIndexTabs *pixmap); static void nautilus_index_tabs_init (NautilusIndexTabs *pixmap);
static gint nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event); static gint nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event);
static void nautilus_index_tabs_finalize (GtkObject *object); static void nautilus_index_tabs_finalize (GtkObject *object);
static gint draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gint test_x, gint test_y);
/* static variables */ /* static variables */
...@@ -195,7 +197,7 @@ nautilus_index_tabs_finalize (GtkObject *object) ...@@ -195,7 +197,7 @@ nautilus_index_tabs_finalize (GtkObject *object)
gint nautilus_index_tabs_hit_test(NautilusIndexTabs *index_tabs, double x, double y) gint nautilus_index_tabs_hit_test(NautilusIndexTabs *index_tabs, double x, double y)
{ {
return 0; /* for now */ return draw_or_hit_test_all_tabs(index_tabs, FALSE, floor(x + .5), floor(y + .5));
} }
/* resize the widget based on the number of tabs */ /* resize the widget based on the number of tabs */
...@@ -264,11 +266,12 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x, ...@@ -264,11 +266,12 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x,
/* draw the right bottom line */ /* draw the right bottom line */
} }
/* draw all of the currently visible tabs */ /* draw or hit test all of the currently visible tabs */
static void static gint
draw_all_tabs(NautilusIndexTabs *index_tabs) draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gint test_x, gint test_y)
{ {
tabItem *second_item;
GList *next_tab = index_tabs->details->tab_items; GList *next_tab = index_tabs->details->tab_items;
GtkWidget *widget = GTK_WIDGET(index_tabs); GtkWidget *widget = GTK_WIDGET(index_tabs);
GdkGC* temp_gc = gdk_gc_new(widget->window); GdkGC* temp_gc = gdk_gc_new(widget->window);
...@@ -285,11 +288,23 @@ draw_all_tabs(NautilusIndexTabs *index_tabs) ...@@ -285,11 +288,23 @@ draw_all_tabs(NautilusIndexTabs *index_tabs)
/* draw the second tab first, if there is one */ /* draw the second tab first, if there is one */
if (next_tab->next) if (next_tab->next)
{ {
tabItem *second_item = next_tab->next->data; second_item = next_tab->next->data;
if (draw_flag)
draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos - 3, TRUE); draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos - 3, TRUE);
} }
if (draw_flag)
draw_one_tab(index_tabs, temp_gc, this_item->tab_text, x_pos, y_pos, FALSE); draw_one_tab(index_tabs, temp_gc, this_item->tab_text, x_pos, y_pos, FALSE);
else if ((test_y >= y_pos) && (test_y <= (y_pos + tab_left_edge->art_pixbuf->height)))
{
gint name_width = gdk_string_width(tab_font, this_item->tab_text) - (2 * tab_indent);
gint edge_width = tab_left_edge->art_pixbuf->width + tab_right_edge->art_pixbuf->width;
if (test_x < (name_width + edge_width))
return this_item->notebook_page;
else if (next_tab->next)
return second_item->notebook_page;
}
next_tab = next_tab->next; next_tab = next_tab->next;
if (next_tab) if (next_tab)
...@@ -298,6 +313,7 @@ draw_all_tabs(NautilusIndexTabs *index_tabs) ...@@ -298,6 +313,7 @@ draw_all_tabs(NautilusIndexTabs *index_tabs)
y_pos += tab_height; y_pos += tab_height;
} }
gdk_gc_unref(temp_gc); gdk_gc_unref(temp_gc);
return -1;
} }
/* find a tab with a given name, or return NULL if we can't find one */ /* find a tab with a given name, or return NULL if we can't find one */
...@@ -331,7 +347,7 @@ nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event) ...@@ -331,7 +347,7 @@ nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event)
/* draw the tabs */ /* draw the tabs */
if (index_tabs->details->tab_count > 0) if (index_tabs->details->tab_count > 0)
draw_all_tabs(index_tabs); draw_or_hit_test_all_tabs(index_tabs, TRUE, 0, 0);
return FALSE; return FALSE;
} }
...@@ -348,6 +364,8 @@ nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, G ...@@ -348,6 +364,8 @@ nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, G
if (item) if (item)
return FALSE; return FALSE;
printf("adding view, name %s, pagenum %d\n", name, page_num);
/* allocate a new entry, and initialize it */ /* allocate a new entry, and initialize it */
new_tab_item = g_new0 (tabItem, 1); new_tab_item = g_new0 (tabItem, 1);
new_tab_item->tab_text = strdup(name); new_tab_item->tab_text = strdup(name);
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
struct _NautilusIndexPanelDetails { struct _NautilusIndexPanelDetails {
GtkWidget *index_container; GtkWidget *index_container;
GtkWidget *per_uri_container; GtkWidget *per_uri_container;
GtkWidget *meta_tabs; GtkWidget *notebook;
GtkWidget *index_tabs; GtkWidget *index_tabs;
char *uri; char *uri;
gint selected_index; gint selected_index;
...@@ -150,14 +150,14 @@ nautilus_index_panel_initialize (GtkObject *object) ...@@ -150,14 +150,14 @@ nautilus_index_panel_initialize (GtkObject *object)
/* allocate and install the meta-tabs */ /* allocate and install the meta-tabs */
index_panel->details->meta_tabs = gtk_notebook_new (); index_panel->details->notebook = gtk_notebook_new ();
gtk_widget_set_usize (index_panel->details->meta_tabs, INDEX_PANEL_WIDTH, 200); gtk_widget_set_usize (index_panel->details->notebook, INDEX_PANEL_WIDTH, 200);
if (USE_NEW_TABS) if (USE_NEW_TABS)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->meta_tabs), FALSE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
else else
{ {
gtk_widget_show (index_panel->details->meta_tabs); gtk_widget_show (index_panel->details->notebook);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->meta_tabs, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
} }
/* prepare ourselves to receive dropped objects */ /* prepare ourselves to receive dropped objects */
...@@ -254,8 +254,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie ...@@ -254,8 +254,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie
label = gtk_label_new (description); label = gtk_label_new (description);
gtk_widget_show (label); gtk_widget_show (label);
gtk_notebook_prepend_page (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view), label); gtk_notebook_append_page (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view), label);
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view)); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view));
/* tell the index tabs about it */ /* tell the index tabs about it */
nautilus_index_tabs_add_view(NAUTILUS_INDEX_TABS(index_panel->details->index_tabs), nautilus_index_tabs_add_view(NAUTILUS_INDEX_TABS(index_panel->details->index_tabs),
...@@ -270,15 +270,23 @@ nautilus_index_panel_remove_meta_view (NautilusIndexPanel *index_panel, Nautilus ...@@ -270,15 +270,23 @@ nautilus_index_panel_remove_meta_view (NautilusIndexPanel *index_panel, Nautilus
{ {
gint page_num; gint page_num;
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view)); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view));
g_return_if_fail (page_num >= 0); g_return_if_fail (page_num >= 0);
gtk_notebook_remove_page (GTK_NOTEBOOK (index_panel->details->meta_tabs), page_num); gtk_notebook_remove_page (GTK_NOTEBOOK (index_panel->details->notebook), page_num);
} }
/* utility to activate the metaview corresponding to the passed in index */ /* utility to activate the metaview corresponding to the passed in index */
static void static void
nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint which_view) nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint which_view)
{ {
GtkNotebook *notebook = GTK_NOTEBOOK(index_panel->details->notebook);
if (index_panel->details->selected_index < 0)
{
gtk_widget_show (index_panel->details->notebook);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
}
index_panel->details->selected_index = which_view;
gtk_notebook_set_page(notebook, which_view);
} }
/* hit-test the index tabs and activate if necessary */ /* hit-test the index tabs and activate if necessary */
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* *
*/ */
#include <math.h>
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtkwidget.h> #include <gtk/gtkwidget.h>
#include <gnome.h> #include <gnome.h>
...@@ -63,6 +64,7 @@ static void nautilus_index_tabs_class_init (NautilusIndexTabsClass *klass); ...@@ -63,6 +64,7 @@ static void nautilus_index_tabs_class_init (NautilusIndexTabsClass *klass);
static void nautilus_index_tabs_init (NautilusIndexTabs *pixmap); static void nautilus_index_tabs_init (NautilusIndexTabs *pixmap);
static gint nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event); static gint nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event);
static void nautilus_index_tabs_finalize (GtkObject *object); static void nautilus_index_tabs_finalize (GtkObject *object);
static gint draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gint test_x, gint test_y);
/* static variables */ /* static variables */
...@@ -195,7 +197,7 @@ nautilus_index_tabs_finalize (GtkObject *object) ...@@ -195,7 +197,7 @@ nautilus_index_tabs_finalize (GtkObject *object)
gint nautilus_index_tabs_hit_test(NautilusIndexTabs *index_tabs, double x, double y) gint nautilus_index_tabs_hit_test(NautilusIndexTabs *index_tabs, double x, double y)
{ {
return 0; /* for now */ return draw_or_hit_test_all_tabs(index_tabs, FALSE, floor(x + .5), floor(y + .5));
} }
/* resize the widget based on the number of tabs */ /* resize the widget based on the number of tabs */
...@@ -264,11 +266,12 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x, ...@@ -264,11 +266,12 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x,
/* draw the right bottom line */ /* draw the right bottom line */
} }
/* draw all of the currently visible tabs */ /* draw or hit test all of the currently visible tabs */
static void static gint
draw_all_tabs(NautilusIndexTabs *index_tabs) draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gint test_x, gint test_y)
{ {
tabItem *second_item;
GList *next_tab = index_tabs->details->tab_items; GList *next_tab = index_tabs->details->tab_items;
GtkWidget *widget = GTK_WIDGET(index_tabs); GtkWidget *widget = GTK_WIDGET(index_tabs);
GdkGC* temp_gc = gdk_gc_new(widget->window); GdkGC* temp_gc = gdk_gc_new(widget->window);
...@@ -285,11 +288,23 @@ draw_all_tabs(NautilusIndexTabs *index_tabs) ...@@ -285,11 +288,23 @@ draw_all_tabs(NautilusIndexTabs *index_tabs)
/* draw the second tab first, if there is one */ /* draw the second tab first, if there is one */
if (next_tab->next) if (next_tab->next)
{ {
tabItem *second_item = next_tab->next->data; second_item = next_tab->next->data;
if (draw_flag)
draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos - 3, TRUE); draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos - 3, TRUE);
} }
if (draw_flag)
draw_one_tab(index_tabs, temp_gc, this_item->tab_text, x_pos, y_pos, FALSE); draw_one_tab(index_tabs, temp_gc, this_item->tab_text, x_pos, y_pos, FALSE);
else if ((test_y >= y_pos) && (test_y <= (y_pos + tab_left_edge->art_pixbuf->height)))
{
gint name_width = gdk_string_width(tab_font, this_item->tab_text) - (2 * tab_indent);
gint edge_width = tab_left_edge->art_pixbuf->width + tab_right_edge->art_pixbuf->width;
if (test_x < (name_width + edge_width))
return this_item->notebook_page;
else if (next_tab->next)
return second_item->notebook_page;
}
next_tab = next_tab->next; next_tab = next_tab->next;
if (next_tab) if (next_tab)
...@@ -298,6 +313,7 @@ draw_all_tabs(NautilusIndexTabs *index_tabs) ...@@ -298,6 +313,7 @@ draw_all_tabs(NautilusIndexTabs *index_tabs)
y_pos += tab_height; y_pos += tab_height;
} }
gdk_gc_unref(temp_gc); gdk_gc_unref(temp_gc);
return -1;
} }
/* find a tab with a given name, or return NULL if we can't find one */ /* find a tab with a given name, or return NULL if we can't find one */
...@@ -331,7 +347,7 @@ nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event) ...@@ -331,7 +347,7 @@ nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event)
/* draw the tabs */ /* draw the tabs */
if (index_tabs->details->tab_count > 0) if (index_tabs->details->tab_count > 0)
draw_all_tabs(index_tabs); draw_or_hit_test_all_tabs(index_tabs, TRUE, 0, 0);
return FALSE; return FALSE;
} }
...@@ -348,6 +364,8 @@ nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, G ...@@ -348,6 +364,8 @@ nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, G
if (item) if (item)
return FALSE; return FALSE;
printf("adding view, name %s, pagenum %d\n", name, page_num);
/* allocate a new entry, and initialize it */ /* allocate a new entry, and initialize it */
new_tab_item = g_new0 (tabItem, 1); new_tab_item = g_new0 (tabItem, 1);
new_tab_item->tab_text = strdup(name); new_tab_item->tab_text = strdup(name);
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
struct _NautilusIndexPanelDetails { struct _NautilusIndexPanelDetails {
GtkWidget *index_container; GtkWidget *index_container;
GtkWidget *per_uri_container; GtkWidget *per_uri_container;
GtkWidget *meta_tabs; GtkWidget *notebook;
GtkWidget *index_tabs; GtkWidget *index_tabs;
char *uri; char *uri;
gint selected_index; gint selected_index;
...@@ -150,14 +150,14 @@ nautilus_index_panel_initialize (GtkObject *object) ...@@ -150,14 +150,14 @@ nautilus_index_panel_initialize (GtkObject *object)
/* allocate and install the meta-tabs */ /* allocate and install the meta-tabs */
index_panel->details->meta_tabs = gtk_notebook_new (); index_panel->details->notebook = gtk_notebook_new ();
gtk_widget_set_usize (index_panel->details->meta_tabs, INDEX_PANEL_WIDTH, 200); gtk_widget_set_usize (index_panel->details->notebook, INDEX_PANEL_WIDTH, 200);
if (USE_NEW_TABS) if (USE_NEW_TABS)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->meta_tabs), FALSE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
else else
{ {
gtk_widget_show (index_panel->details->meta_tabs); gtk_widget_show (index_panel->details->notebook);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->meta_tabs, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
} }
/* prepare ourselves to receive dropped objects */ /* prepare ourselves to receive dropped objects */
...@@ -254,8 +254,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie ...@@ -254,8 +254,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie
label = gtk_label_new (description); label = gtk_label_new (description);
gtk_widget_show (label); gtk_widget_show (label);
gtk_notebook_prepend_page (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view), label); gtk_notebook_append_page (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view), label);
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view)); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view));
/* tell the index tabs about it */ /* tell the index tabs about it */
nautilus_index_tabs_add_view(NAUTILUS_INDEX_TABS(index_panel->details->index_tabs), nautilus_index_tabs_add_view(NAUTILUS_INDEX_TABS(index_panel->details->index_tabs),
...@@ -270,15 +270,23 @@ nautilus_index_panel_remove_meta_view (NautilusIndexPanel *index_panel, Nautilus ...@@ -270,15 +270,23 @@ nautilus_index_panel_remove_meta_view (NautilusIndexPanel *index_panel, Nautilus
{ {
gint page_num; gint page_num;
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view)); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view));
g_return_if_fail (page_num >= 0); g_return_if_fail (page_num >= 0);
gtk_notebook_remove_page (GTK_NOTEBOOK (index_panel->details->meta_tabs), page_num); gtk_notebook_remove_page (GTK_NOTEBOOK (index_panel->details->notebook), page_num);
} }
/* utility to activate the metaview corresponding to the passed in index */ /* utility to activate the metaview corresponding to the passed in index */
static void static void
nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint which_view) nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint which_view)
{ {
GtkNotebook *notebook = GTK_NOTEBOOK(index_panel->details->notebook);
if (index_panel->details->selected_index < 0)
{
gtk_widget_show (index_panel->details->notebook);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
}
index_panel->details->selected_index = which_view;
gtk_notebook_set_page(notebook, which_view);
} }
/* hit-test the index tabs and activate if necessary */ /* hit-test the index tabs and activate if necessary */
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
struct _NautilusIndexPanelDetails { struct _NautilusIndexPanelDetails {
GtkWidget *index_container; GtkWidget *index_container;
GtkWidget *per_uri_container; GtkWidget *per_uri_container;
GtkWidget *meta_tabs; GtkWidget *notebook;
GtkWidget *index_tabs; GtkWidget *index_tabs;
char *uri; char *uri;
gint selected_index; gint selected_index;
...@@ -150,14 +150,14 @@ nautilus_index_panel_initialize (GtkObject *object) ...@@ -150,14 +150,14 @@ nautilus_index_panel_initialize (GtkObject *object)
/* allocate and install the meta-tabs */ /* allocate and install the meta-tabs */
index_panel->details->meta_tabs = gtk_notebook_new (); index_panel->details->notebook = gtk_notebook_new ();
gtk_widget_set_usize (index_panel->details->meta_tabs, INDEX_PANEL_WIDTH, 200); gtk_widget_set_usize (index_panel->details->notebook, INDEX_PANEL_WIDTH, 200);
if (USE_NEW_TABS) if (USE_NEW_TABS)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->meta_tabs), FALSE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
else else
{ {
gtk_widget_show (index_panel->details->meta_tabs); gtk_widget_show (index_panel->details->notebook);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->meta_tabs, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
} }
/* prepare ourselves to receive dropped objects */ /* prepare ourselves to receive dropped objects */
...@@ -254,8 +254,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie ...@@ -254,8 +254,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie
label = gtk_label_new (description); label = gtk_label_new (description);
gtk_widget_show (label); gtk_widget_show (label);
gtk_notebook_prepend_page (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view), label); gtk_notebook_append_page (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view), label);
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view)); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view));
/* tell the index tabs about it */ /* tell the index tabs about it */
nautilus_index_tabs_add_view(NAUTILUS_INDEX_TABS(index_panel->details->index_tabs), nautilus_index_tabs_add_view(NAUTILUS_INDEX_TABS(index_panel->details->index_tabs),
...@@ -270,15 +270,23 @@ nautilus_index_panel_remove_meta_view (NautilusIndexPanel *index_panel, Nautilus ...@@ -270,15 +270,23 @@ nautilus_index_panel_remove_meta_view (NautilusIndexPanel *index_panel, Nautilus
{ {
gint page_num; gint page_num;
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->meta_tabs), GTK_WIDGET (meta_view)); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (index_panel->details->notebook), GTK_WIDGET (meta_view));
g_return_if_fail (page_num >= 0); g_return_if_fail (page_num >= 0);
gtk_notebook_remove_page (GTK_NOTEBOOK (index_panel->details->meta_tabs), page_num); gtk_notebook_remove_page (GTK_NOTEBOOK (index_panel->details->notebook), page_num);
} }
/* utility to activate the metaview corresponding to the passed in index */ /* utility to activate the metaview corresponding to the passed in index */
static void static void
nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint which_view) nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint which_view)
{ {
GtkNotebook *notebook = GTK_NOTEBOOK(index_panel->details->notebook);
if (index_panel->details->selected_index < 0)
{
gtk_widget_show (index_panel->details->notebook);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
}
index_panel->details->selected_index = which_view;
gtk_notebook_set_page(notebook, which_view);
} }
/* hit-test the index tabs and activate if necessary */ /* hit-test the index tabs and activate if necessary */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment