Commit 6028e081 authored by Andy Hertzfeld's avatar Andy Hertzfeld

finally installed the new metaview UI in the index panel


      finally installed the new metaview UI in the index panel
parent c3ac75e6
2000-02-11 Andy Hertzfeld <andy@eazel.com>
Finally enabled the new metaview UI
* src/nautilus-index-tabs.c,h:
made clicking on the title tab deactivate the current metaview
removed the panel_width field since it didn't work for the
resizable panel, instead, look at the parents width on the fly
added code to test lots of tabs and improved the drawing in that case
before removing the test code.
* src/ntl-index-panel.c:
removed the USE_NEW_TABS boolean; we always use them now
2000-02-11 John Sullivan <sullivan@eazel.com>
Made right-clicking on an item select just that one item
......@@ -115,12 +128,12 @@
2000-02-10 Andy Hertzfeld <andy@eazel.com>
* src/ntl-index-panel.c:
added code to hide metaview when the title tab is clicked upon
* src/nautilus-index-tabs.c:
made hit-testing work for the title tab
* src/ntl-window.c:
defaulted hpaned position to proper size
* src/ntl-index-panel.c:
added code to hide metaview when the title tab is clicked upon
* src/nautilus-index-tabs.c:
made hit-testing work for the title tab
* src/ntl-window.c:
defaulted hpaned position to proper size
2000-02-10 Andy Hertzfeld <andy@eazel.com>
......
......@@ -45,7 +45,6 @@ struct _NautilusIndexTabsDetails
{
int tab_count;
int selected_tab;
int panel_width;
gboolean title_mode;
GdkColor tab_color;
......@@ -161,11 +160,10 @@ nautilus_index_tabs_init (NautilusIndexTabs *index_tabs)
}
GtkWidget*
nautilus_index_tabs_new (gint container_width)
nautilus_index_tabs_new ()
{
NautilusIndexTabs *index_tabs;
index_tabs = gtk_type_new (nautilus_index_tabs_get_type ());
index_tabs->details->panel_width = container_width;
return GTK_WIDGET (index_tabs);
}
......@@ -217,7 +215,8 @@ recalculate_size(NautilusIndexTabs *index_tabs)
{
GtkWidget *widget = GTK_WIDGET (index_tabs);
gint tab_rows = (index_tabs->details->tab_count + 1) >> 1;
widget->requisition.width = index_tabs->details->panel_width;
widget->requisition.width = widget->parent ? widget->parent->allocation.width: 136;
if (index_tabs->details->title_mode)
widget->requisition.height = tab_left_edge->art_pixbuf->height;
else
......@@ -230,8 +229,7 @@ recalculate_size(NautilusIndexTabs *index_tabs)
static void
draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x, gint y, gboolean right_flag)
{
GdkGCValues saved_values;
gint text_y_offset, tab_bottom, tab_right;
gint text_y_offset, tab_bottom, tab_right;
/* measure the name and compute the bounding box */
gint name_width = gdk_string_width(tab_font, tab_name) - 2*TAB_INDENT;
GtkWidget *widget = GTK_WIDGET(index_tabs);
......@@ -244,11 +242,9 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x,
/* clear the tab rectangle */
gdk_gc_get_values(gc, &saved_values);
gdk_gc_set_foreground (gc, &index_tabs->details->tab_color);
gdk_draw_rectangle (widget->window, gc, TRUE, x + tab_left_edge->art_pixbuf->width, y, name_width, tab_left_edge->art_pixbuf->height);
gdk_gc_set_foreground (gc, &saved_values.foreground);
/* draw the two edges with the pixbufs */
gdk_pixbuf_render_to_drawable_alpha (tab_left_edge, widget->window, 0, 0, x, y,
tab_left_edge->art_pixbuf->width, tab_left_edge->art_pixbuf->height,
......@@ -273,7 +269,7 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x,
tab_bottom = y + tab_left_edge->art_pixbuf->height - 2;
tab_right = x + tab_left_edge->art_pixbuf->width + name_width + tab_right_edge->art_pixbuf->width - 2*TAB_INDENT - 1;
gdk_gc_set_foreground (gc, &index_tabs->details->line_color);
gdk_draw_line(widget->window, gc, tab_right, tab_bottom, index_tabs->details->panel_width, tab_bottom);
gdk_draw_line(widget->window, gc, tab_right, tab_bottom, widget->parent->allocation.width, tab_bottom);
/* draw the right bottom line, too */
gdk_draw_line(widget->window, gc, 0, tab_bottom, x, tab_bottom);
......@@ -304,9 +300,16 @@ draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gin
return -1;
}
/* allocate a graphic context and clear the space below the top tabs to the background color */
if (draw_flag)
temp_gc = gdk_gc_new(widget->window);
{
gint y_top = widget->allocation.y + tab_left_edge->art_pixbuf->height;
gint fill_height = widget->allocation.y + widget->allocation.height - y_top;
temp_gc = gdk_gc_new(widget->window);
gdk_gc_set_foreground (temp_gc, &index_tabs->details->tab_color);
gdk_draw_rectangle (widget->window, temp_gc, TRUE, widget->allocation.x, y_top, widget->allocation.width, fill_height);
}
/* we must draw two items at a time, drawing the second one first, because the first one overlaps the second */
while (next_tab != NULL)
......@@ -318,7 +321,12 @@ draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gin
{
second_item = next_tab->next->data;
if (draw_flag && second_item->visible)
draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos - 3, TRUE);
{
gint y_offset = 0;
if (this_item->visible)
y_offset -= 3;
draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos + y_offset, TRUE);
}
}
if (draw_flag && this_item->visible)
......@@ -338,7 +346,7 @@ draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gin
if (next_tab)
next_tab = next_tab->next;
y_pos += tab_height;
y_pos -= tab_height;
}
if (draw_flag)
......@@ -400,10 +408,10 @@ nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event)
gboolean
nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, GtkWidget *new_view, gint page_num)
{
/* check to see if we already have one with this name, if so, refuse to add it */
/* check to see if we already have one with this name, if so, refuse to add it */
tabItem *new_tab_item;
GList *item = find_tab(index_tabs, name);
if (item)
return FALSE;
......@@ -425,7 +433,8 @@ nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, G
index_tabs->details->tab_count += 1;
recalculate_size(index_tabs);
gtk_widget_queue_draw(GTK_WIDGET(index_tabs));
return TRUE;
}
......@@ -462,6 +471,7 @@ nautilus_index_tabs_remove_view(NautilusIndexTabs *index_tabs, const gchar *name
index_tabs->details->tab_count -= 1;
recalculate_size(index_tabs);
gtk_widget_queue_draw(GTK_WIDGET(index_tabs));
}
/* select a tab, from its associated notebook page number, by making it invisible and all
......
......@@ -61,7 +61,7 @@ struct _NautilusIndexTabsClass
GtkType nautilus_index_tabs_get_type(void);
GtkWidget* nautilus_index_tabs_new(gint container_width);
GtkWidget* nautilus_index_tabs_new(void);
gboolean nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, GtkWidget *new_view, gint page_num);
gchar* nautilus_index_tabs_get_title_from_index(NautilusIndexTabs *index_tabs, gint which_tab);
......
......@@ -69,7 +69,6 @@ static void nautilus_index_panel_set_up_logo (NautilusIndexPanel *index_panel, c
static GdkFont *select_font(const gchar *text_to_format, gint width, const gchar* font_template);
#define DEFAULT_BACKGROUND_COLOR "rgb:DDDD/DDDD/FFFF"
#define USE_NEW_TABS 0
#define INDEX_PANEL_WIDTH 136
/* drag and drop definitions */
......@@ -140,30 +139,21 @@ nautilus_index_panel_initialize (GtkObject *object)
make_per_uri_container (index_panel);
/* first, allocate the index tabs */
index_panel->details->index_tabs = GTK_WIDGET(nautilus_index_tabs_new(INDEX_PANEL_WIDTH));
index_panel->details->index_tabs = GTK_WIDGET(nautilus_index_tabs_new());
index_panel->details->selected_index = -1;
/* also, allocate the title tab */
index_panel->details->title_tab = GTK_WIDGET(nautilus_index_tabs_new(INDEX_PANEL_WIDTH));
index_panel->details->title_tab = GTK_WIDGET(nautilus_index_tabs_new());
nautilus_index_tabs_set_title_mode(NAUTILUS_INDEX_TABS(index_panel->details->title_tab), TRUE);
if (USE_NEW_TABS)
{
gtk_widget_show (index_panel->details->index_tabs);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->index_tabs, FALSE, FALSE, 0);
}
gtk_widget_show (index_panel->details->index_tabs);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->index_tabs, FALSE, FALSE, 0);
/* allocate and install the meta-tabs */
index_panel->details->notebook = gtk_notebook_new ();
gtk_widget_set_usize (index_panel->details->notebook, INDEX_PANEL_WIDTH, 200);
if (USE_NEW_TABS)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
else
{
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);
}
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
/* prepare ourselves to receive dropped objects */
gtk_drag_dest_set (GTK_WIDGET (index_panel),
......@@ -289,10 +279,12 @@ nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint wh
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);
if (index_panel->details->notebook->parent == NULL)
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
gtk_widget_show (index_panel->details->title_tab);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->title_tab, FALSE, FALSE, 0);
if (index_panel->details->title_tab->parent == NULL)
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->title_tab, FALSE, FALSE, 0);
}
index_panel->details->selected_index = which_view;
......@@ -310,10 +302,7 @@ nautilus_index_panel_deactivate_meta_view(NautilusIndexPanel *index_panel)
if (index_panel->details->selected_index >= 0)
{
gtk_widget_hide (index_panel->details->notebook);
gtk_container_remove (GTK_CONTAINER (index_panel->details->index_container), index_panel->details->notebook);
gtk_widget_hide (index_panel->details->title_tab);
gtk_container_remove (GTK_CONTAINER (index_panel->details->index_container), index_panel->details->title_tab);
}
index_panel->details->selected_index = -1;
......@@ -330,10 +319,7 @@ nautilus_index_panel_press_event (GtkWidget *widget, GdkEventButton *event)
NautilusIndexTabs *index_tabs = NAUTILUS_INDEX_TABS(index_panel->details->index_tabs);
NautilusIndexTabs *title_tab = NAUTILUS_INDEX_TABS(index_panel->details->title_tab);
gint rounded_y = floor(event->y + .5);
if (!USE_NEW_TABS)
return FALSE;
/* if the click is in the main tabs, tell them about it */
if (rounded_y >= index_panel->details->index_tabs->allocation.y)
{
......
......@@ -45,7 +45,6 @@ struct _NautilusIndexTabsDetails
{
int tab_count;
int selected_tab;
int panel_width;
gboolean title_mode;
GdkColor tab_color;
......@@ -161,11 +160,10 @@ nautilus_index_tabs_init (NautilusIndexTabs *index_tabs)
}
GtkWidget*
nautilus_index_tabs_new (gint container_width)
nautilus_index_tabs_new ()
{
NautilusIndexTabs *index_tabs;
index_tabs = gtk_type_new (nautilus_index_tabs_get_type ());
index_tabs->details->panel_width = container_width;
return GTK_WIDGET (index_tabs);
}
......@@ -217,7 +215,8 @@ recalculate_size(NautilusIndexTabs *index_tabs)
{
GtkWidget *widget = GTK_WIDGET (index_tabs);
gint tab_rows = (index_tabs->details->tab_count + 1) >> 1;
widget->requisition.width = index_tabs->details->panel_width;
widget->requisition.width = widget->parent ? widget->parent->allocation.width: 136;
if (index_tabs->details->title_mode)
widget->requisition.height = tab_left_edge->art_pixbuf->height;
else
......@@ -230,8 +229,7 @@ recalculate_size(NautilusIndexTabs *index_tabs)
static void
draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x, gint y, gboolean right_flag)
{
GdkGCValues saved_values;
gint text_y_offset, tab_bottom, tab_right;
gint text_y_offset, tab_bottom, tab_right;
/* measure the name and compute the bounding box */
gint name_width = gdk_string_width(tab_font, tab_name) - 2*TAB_INDENT;
GtkWidget *widget = GTK_WIDGET(index_tabs);
......@@ -244,11 +242,9 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x,
/* clear the tab rectangle */
gdk_gc_get_values(gc, &saved_values);
gdk_gc_set_foreground (gc, &index_tabs->details->tab_color);
gdk_draw_rectangle (widget->window, gc, TRUE, x + tab_left_edge->art_pixbuf->width, y, name_width, tab_left_edge->art_pixbuf->height);
gdk_gc_set_foreground (gc, &saved_values.foreground);
/* draw the two edges with the pixbufs */
gdk_pixbuf_render_to_drawable_alpha (tab_left_edge, widget->window, 0, 0, x, y,
tab_left_edge->art_pixbuf->width, tab_left_edge->art_pixbuf->height,
......@@ -273,7 +269,7 @@ draw_one_tab(NautilusIndexTabs *index_tabs, GdkGC *gc, gchar *tab_name, gint x,
tab_bottom = y + tab_left_edge->art_pixbuf->height - 2;
tab_right = x + tab_left_edge->art_pixbuf->width + name_width + tab_right_edge->art_pixbuf->width - 2*TAB_INDENT - 1;
gdk_gc_set_foreground (gc, &index_tabs->details->line_color);
gdk_draw_line(widget->window, gc, tab_right, tab_bottom, index_tabs->details->panel_width, tab_bottom);
gdk_draw_line(widget->window, gc, tab_right, tab_bottom, widget->parent->allocation.width, tab_bottom);
/* draw the right bottom line, too */
gdk_draw_line(widget->window, gc, 0, tab_bottom, x, tab_bottom);
......@@ -304,9 +300,16 @@ draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gin
return -1;
}
/* allocate a graphic context and clear the space below the top tabs to the background color */
if (draw_flag)
temp_gc = gdk_gc_new(widget->window);
{
gint y_top = widget->allocation.y + tab_left_edge->art_pixbuf->height;
gint fill_height = widget->allocation.y + widget->allocation.height - y_top;
temp_gc = gdk_gc_new(widget->window);
gdk_gc_set_foreground (temp_gc, &index_tabs->details->tab_color);
gdk_draw_rectangle (widget->window, temp_gc, TRUE, widget->allocation.x, y_top, widget->allocation.width, fill_height);
}
/* we must draw two items at a time, drawing the second one first, because the first one overlaps the second */
while (next_tab != NULL)
......@@ -318,7 +321,12 @@ draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gin
{
second_item = next_tab->next->data;
if (draw_flag && second_item->visible)
draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos - 3, TRUE);
{
gint y_offset = 0;
if (this_item->visible)
y_offset -= 3;
draw_one_tab(index_tabs, temp_gc, second_item->tab_text, x_pos, y_pos + y_offset, TRUE);
}
}
if (draw_flag && this_item->visible)
......@@ -338,7 +346,7 @@ draw_or_hit_test_all_tabs(NautilusIndexTabs *index_tabs, gboolean draw_flag, gin
if (next_tab)
next_tab = next_tab->next;
y_pos += tab_height;
y_pos -= tab_height;
}
if (draw_flag)
......@@ -400,10 +408,10 @@ nautilus_index_tabs_expose (GtkWidget *widget, GdkEventExpose *event)
gboolean
nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, GtkWidget *new_view, gint page_num)
{
/* check to see if we already have one with this name, if so, refuse to add it */
/* check to see if we already have one with this name, if so, refuse to add it */
tabItem *new_tab_item;
GList *item = find_tab(index_tabs, name);
if (item)
return FALSE;
......@@ -425,7 +433,8 @@ nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, G
index_tabs->details->tab_count += 1;
recalculate_size(index_tabs);
gtk_widget_queue_draw(GTK_WIDGET(index_tabs));
return TRUE;
}
......@@ -462,6 +471,7 @@ nautilus_index_tabs_remove_view(NautilusIndexTabs *index_tabs, const gchar *name
index_tabs->details->tab_count -= 1;
recalculate_size(index_tabs);
gtk_widget_queue_draw(GTK_WIDGET(index_tabs));
}
/* select a tab, from its associated notebook page number, by making it invisible and all
......
......@@ -61,7 +61,7 @@ struct _NautilusIndexTabsClass
GtkType nautilus_index_tabs_get_type(void);
GtkWidget* nautilus_index_tabs_new(gint container_width);
GtkWidget* nautilus_index_tabs_new(void);
gboolean nautilus_index_tabs_add_view(NautilusIndexTabs *index_tabs, const gchar *name, GtkWidget *new_view, gint page_num);
gchar* nautilus_index_tabs_get_title_from_index(NautilusIndexTabs *index_tabs, gint which_tab);
......
......@@ -69,7 +69,6 @@ static void nautilus_index_panel_set_up_logo (NautilusIndexPanel *index_panel, c
static GdkFont *select_font(const gchar *text_to_format, gint width, const gchar* font_template);
#define DEFAULT_BACKGROUND_COLOR "rgb:DDDD/DDDD/FFFF"
#define USE_NEW_TABS 0
#define INDEX_PANEL_WIDTH 136
/* drag and drop definitions */
......@@ -140,30 +139,21 @@ nautilus_index_panel_initialize (GtkObject *object)
make_per_uri_container (index_panel);
/* first, allocate the index tabs */
index_panel->details->index_tabs = GTK_WIDGET(nautilus_index_tabs_new(INDEX_PANEL_WIDTH));
index_panel->details->index_tabs = GTK_WIDGET(nautilus_index_tabs_new());
index_panel->details->selected_index = -1;
/* also, allocate the title tab */
index_panel->details->title_tab = GTK_WIDGET(nautilus_index_tabs_new(INDEX_PANEL_WIDTH));
index_panel->details->title_tab = GTK_WIDGET(nautilus_index_tabs_new());
nautilus_index_tabs_set_title_mode(NAUTILUS_INDEX_TABS(index_panel->details->title_tab), TRUE);
if (USE_NEW_TABS)
{
gtk_widget_show (index_panel->details->index_tabs);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->index_tabs, FALSE, FALSE, 0);
}
gtk_widget_show (index_panel->details->index_tabs);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->index_tabs, FALSE, FALSE, 0);
/* allocate and install the meta-tabs */
index_panel->details->notebook = gtk_notebook_new ();
gtk_widget_set_usize (index_panel->details->notebook, INDEX_PANEL_WIDTH, 200);
if (USE_NEW_TABS)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
else
{
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);
}
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
/* prepare ourselves to receive dropped objects */
gtk_drag_dest_set (GTK_WIDGET (index_panel),
......@@ -289,10 +279,12 @@ nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint wh
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);
if (index_panel->details->notebook->parent == NULL)
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
gtk_widget_show (index_panel->details->title_tab);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->title_tab, FALSE, FALSE, 0);
if (index_panel->details->title_tab->parent == NULL)
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->title_tab, FALSE, FALSE, 0);
}
index_panel->details->selected_index = which_view;
......@@ -310,10 +302,7 @@ nautilus_index_panel_deactivate_meta_view(NautilusIndexPanel *index_panel)
if (index_panel->details->selected_index >= 0)
{
gtk_widget_hide (index_panel->details->notebook);
gtk_container_remove (GTK_CONTAINER (index_panel->details->index_container), index_panel->details->notebook);
gtk_widget_hide (index_panel->details->title_tab);
gtk_container_remove (GTK_CONTAINER (index_panel->details->index_container), index_panel->details->title_tab);
}
index_panel->details->selected_index = -1;
......@@ -330,10 +319,7 @@ nautilus_index_panel_press_event (GtkWidget *widget, GdkEventButton *event)
NautilusIndexTabs *index_tabs = NAUTILUS_INDEX_TABS(index_panel->details->index_tabs);
NautilusIndexTabs *title_tab = NAUTILUS_INDEX_TABS(index_panel->details->title_tab);
gint rounded_y = floor(event->y + .5);
if (!USE_NEW_TABS)
return FALSE;
/* if the click is in the main tabs, tell them about it */
if (rounded_y >= index_panel->details->index_tabs->allocation.y)
{
......
......@@ -69,7 +69,6 @@ static void nautilus_index_panel_set_up_logo (NautilusIndexPanel *index_panel, c
static GdkFont *select_font(const gchar *text_to_format, gint width, const gchar* font_template);
#define DEFAULT_BACKGROUND_COLOR "rgb:DDDD/DDDD/FFFF"
#define USE_NEW_TABS 0
#define INDEX_PANEL_WIDTH 136
/* drag and drop definitions */
......@@ -140,30 +139,21 @@ nautilus_index_panel_initialize (GtkObject *object)
make_per_uri_container (index_panel);
/* first, allocate the index tabs */
index_panel->details->index_tabs = GTK_WIDGET(nautilus_index_tabs_new(INDEX_PANEL_WIDTH));
index_panel->details->index_tabs = GTK_WIDGET(nautilus_index_tabs_new());
index_panel->details->selected_index = -1;
/* also, allocate the title tab */
index_panel->details->title_tab = GTK_WIDGET(nautilus_index_tabs_new(INDEX_PANEL_WIDTH));
index_panel->details->title_tab = GTK_WIDGET(nautilus_index_tabs_new());
nautilus_index_tabs_set_title_mode(NAUTILUS_INDEX_TABS(index_panel->details->title_tab), TRUE);
if (USE_NEW_TABS)
{
gtk_widget_show (index_panel->details->index_tabs);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->index_tabs, FALSE, FALSE, 0);
}
gtk_widget_show (index_panel->details->index_tabs);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->index_tabs, FALSE, FALSE, 0);
/* allocate and install the meta-tabs */
index_panel->details->notebook = gtk_notebook_new ();
gtk_widget_set_usize (index_panel->details->notebook, INDEX_PANEL_WIDTH, 200);
if (USE_NEW_TABS)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
else
{
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);
}
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(index_panel->details->notebook), FALSE);
/* prepare ourselves to receive dropped objects */
gtk_drag_dest_set (GTK_WIDGET (index_panel),
......@@ -289,10 +279,12 @@ nautilus_index_panel_activate_meta_view(NautilusIndexPanel *index_panel, gint wh
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);
if (index_panel->details->notebook->parent == NULL)
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->notebook, FALSE, FALSE, 0);
gtk_widget_show (index_panel->details->title_tab);
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->title_tab, FALSE, FALSE, 0);
if (index_panel->details->title_tab->parent == NULL)
gtk_box_pack_end (GTK_BOX (index_panel->details->index_container), index_panel->details->title_tab, FALSE, FALSE, 0);
}
index_panel->details->selected_index = which_view;
......@@ -310,10 +302,7 @@ nautilus_index_panel_deactivate_meta_view(NautilusIndexPanel *index_panel)
if (index_panel->details->selected_index >= 0)
{
gtk_widget_hide (index_panel->details->notebook);
gtk_container_remove (GTK_CONTAINER (index_panel->details->index_container), index_panel->details->notebook);
gtk_widget_hide (index_panel->details->title_tab);
gtk_container_remove (GTK_CONTAINER (index_panel->details->index_container), index_panel->details->title_tab);
}
index_panel->details->selected_index = -1;
......@@ -330,10 +319,7 @@ nautilus_index_panel_press_event (GtkWidget *widget, GdkEventButton *event)
NautilusIndexTabs *index_tabs = NAUTILUS_INDEX_TABS(index_panel->details->index_tabs);
NautilusIndexTabs *title_tab = NAUTILUS_INDEX_TABS(index_panel->details->title_tab);
gint rounded_y = floor(event->y + .5);
if (!USE_NEW_TABS)
return FALSE;
/* if the click is in the main tabs, tell them about it */
if (rounded_y >= index_panel->details->index_tabs->allocation.y)
{
......
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