removed the nautilus-toolbar class, since it was obsoleted by the recent

* src/Makefile.am:
	* src/nautilus-toolbar.c:
	* src/nautilus-toolbar.h:
	removed the nautilus-toolbar class, since it was obsoleted by the
	recent bonobo ui handler changes.

	* src/nautilus-window-toolbars.c:
	removed unused reference to nautilus-toolbar.h
This commit is contained in:
Andy Hertzfeld 2000-10-13 02:18:41 +00:00
parent 9d6efcc50e
commit 116c3b58bf
5 changed files with 11 additions and 380 deletions

View file

@ -1,3 +1,14 @@
2000-10-12 Andy Hertzfeld <andy@eazel.com>
* src/Makefile.am:
* src/nautilus-toolbar.c:
* src/nautilus-toolbar.h:
removed the nautilus-toolbar class, since it was obsoleted by the
recent bonobo ui handler changes.
* src/nautilus-window-toolbars.c:
removed unused reference to nautilus-toolbar.h
2000-10-12 Ali Abdin <aliabdin@aucegypt.edu>
* components/help/converters/gnome-db2html2/toc-elements.c:

View file

@ -82,7 +82,6 @@ noinst_HEADERS = \
nautilus-switchable-search-bar.h \
nautilus-theme-selector.h \
nautilus-throbber.h \
nautilus-toolbar.h \
nautilus-view-frame-private.h \
nautilus-view-frame.h \
nautilus-window-manage-views.h \
@ -123,7 +122,6 @@ nautilus_SOURCES = \
nautilus-switchable-search-bar.c \
nautilus-theme-selector.c \
nautilus-throbber.c \
nautilus-toolbar.c \
nautilus-view-frame-corba.c \
nautilus-view-frame.c \
nautilus-window-manage-views.c \

View file

@ -1,322 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Nautilus
*
* Copyright (C) 2000 Eazel, Inc.
*
* Nautilus is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* Nautilus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Andy Hertzfeld <andy@eazel.com>
*/
/* nautilus-toolbar.c - toolbar for Nautilus to overcome fixed spacing problem
*/
#include <config.h>
#include <gtk/gtktoolbar.h>
#include <gnome.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-toolbar.h"
typedef struct _GtkToolbarChildSpace GtkToolbarChildSpace;
struct _GtkToolbarChildSpace
{
GtkToolbarChild child;
gint alloc_x, alloc_y;
};
static void nautilus_toolbar_initialize_class (NautilusToolbarClass *class);
static void nautilus_toolbar_initialize (NautilusToolbar *bar);
static void nautilus_toolbar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void nautilus_toolbar_size_request (GtkWidget *widget,
GtkRequisition *requisition);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusToolbar, nautilus_toolbar, GTK_TYPE_TOOLBAR)
GtkWidget *
nautilus_toolbar_new (void)
{
return gtk_widget_new (NAUTILUS_TYPE_TOOLBAR, NULL);
}
static void
nautilus_toolbar_initialize_class (NautilusToolbarClass *klass)
{
GtkWidgetClass *widget_class;
widget_class = (GtkWidgetClass *) klass;
widget_class->size_allocate = nautilus_toolbar_size_allocate;
widget_class->size_request = nautilus_toolbar_size_request;
}
static void
nautilus_toolbar_initialize (NautilusToolbar *bar)
{
bar->button_spacing = 48; /* default to reasonable amount */
}
void
nautilus_toolbar_set_button_spacing (NautilusToolbar *toolbar, int spacing)
{
toolbar->button_spacing = spacing;
}
void nautilus_toolbar_set_throbber (NautilusToolbar *bar, GtkWidget *new_throbber)
{
bar->throbber = new_throbber;
}
static void
nautilus_toolbar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkToolbar *toolbar;
GtkToolbarChildSpace *child_space;
NautilusToolbar *nautilus_toolbar;
GList *children;
GtkToolbarChild *child;
GtkAllocation alloc;
GtkRequisition child_requisition;
int border_width;
int spacing, save_x;
int item_width, item_height;
int width_to_use, height_to_use;
gboolean is_throbber;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (widget));
g_return_if_fail (allocation != NULL);
save_x = 0;
toolbar = GTK_TOOLBAR (widget);
nautilus_toolbar = NAUTILUS_TOOLBAR (widget);
spacing = nautilus_toolbar->button_spacing;
widget->allocation = *allocation;
border_width = GTK_CONTAINER (toolbar)->border_width;
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
alloc.x = allocation->x + border_width;
else
alloc.y = allocation->y + border_width;
for (children = toolbar->children; children; children = children->next)
{
child = children->data;
switch (child->type)
{
case GTK_TOOLBAR_CHILD_SPACE:
child_space = (GtkToolbarChildSpace *) child;
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
{
child_space->alloc_x = alloc.x;
child_space->alloc_y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
alloc.x += toolbar->space_size;
}
else
{
child_space->alloc_x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
child_space->alloc_y = alloc.y;
alloc.y += toolbar->space_size;
}
break;
case GTK_TOOLBAR_CHILD_BUTTON:
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
if (!GTK_WIDGET_VISIBLE (child->widget))
break;
item_width = child->widget->requisition.width;
item_height = child->widget->requisition.height;
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) {
width_to_use = (item_width > spacing) ? item_width : spacing;
height_to_use = toolbar->button_maxh;
} else {
width_to_use = toolbar->button_maxw;
height_to_use = (item_height > spacing) ? item_height : spacing;
}
alloc.width = width_to_use;
alloc.height = height_to_use;
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
alloc.y = allocation->y + (allocation->height - height_to_use) / 2;
else
alloc.x = allocation->x + (allocation->width - width_to_use) / 2;
gtk_widget_size_allocate (child->widget, &alloc);
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
alloc.x += width_to_use;
else
alloc.y += height_to_use;
break;
case GTK_TOOLBAR_CHILD_WIDGET:
if (!GTK_WIDGET_VISIBLE (child->widget))
break;
gtk_widget_get_child_requisition (child->widget, &child_requisition);
alloc.width = child_requisition.width;
alloc.height = child_requisition.height;
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
alloc.y = allocation->y + (allocation->height - child_requisition.height) / 2;
else
alloc.x = allocation->x + (allocation->width - child_requisition.width) / 2;
/* special case the throbber, so it's positioned at the far right */
is_throbber = child->widget == nautilus_toolbar->throbber &&
toolbar->orientation == GTK_ORIENTATION_HORIZONTAL;
if (is_throbber) {
save_x = alloc.x;
alloc.x = widget->allocation.width - alloc.width;
}
gtk_widget_size_allocate (child->widget, &alloc);
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
alloc.x += child_requisition.width;
else
alloc.y += child_requisition.height;
if (is_throbber ) {
alloc.x = save_x;
}
break;
default:
g_assert_not_reached ();
}
}
}
static void
nautilus_toolbar_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkToolbar *toolbar;
NautilusToolbar *nautilus_toolbar;
GList *children;
GtkToolbarChild *child;
gint nbuttons, spacing;
gint button_maxw, button_maxh;
gint widget_maxw, widget_maxh;
GtkRequisition child_requisition;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (widget));
g_return_if_fail (requisition != NULL);
toolbar = GTK_TOOLBAR (widget);
nautilus_toolbar = NAUTILUS_TOOLBAR (widget);
spacing = nautilus_toolbar->button_spacing;
requisition->width = GTK_CONTAINER (toolbar)->border_width * 2;
requisition->height = GTK_CONTAINER (toolbar)->border_width * 2;
nbuttons = 0;
button_maxw = 0;
button_maxh = 0;
widget_maxw = 0;
widget_maxh = 0;
for (children = toolbar->children; children; children = children->next)
{
child = children->data;
switch (child->type)
{
case GTK_TOOLBAR_CHILD_SPACE:
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
requisition->width += toolbar->space_size;
else
requisition->height += toolbar->space_size;
break;
case GTK_TOOLBAR_CHILD_BUTTON:
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
if (GTK_WIDGET_VISIBLE (child->widget))
{
gtk_widget_size_request (child->widget, &child_requisition);
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) {
requisition->width += (child_requisition.width > spacing) ? child_requisition.width : spacing;
} else {
requisition->height += (child_requisition.height > spacing) ? child_requisition.height : spacing;
}
nbuttons++;
button_maxw = MAX (button_maxw, child_requisition.width);
button_maxh = MAX (button_maxh, child_requisition.height);
}
break;
case GTK_TOOLBAR_CHILD_WIDGET:
if (GTK_WIDGET_VISIBLE (child->widget))
{
gtk_widget_size_request (child->widget, &child_requisition);
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
requisition->width += child_requisition.width + toolbar->space_size ;
else
requisition->height += child_requisition.height + toolbar->space_size;
}
break;
default:
g_assert_not_reached ();
}
}
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
{
requisition->height += MAX (button_maxh, widget_maxh);
}
else
{
requisition->width += MAX (button_maxw, widget_maxw);
}
toolbar->button_maxw = button_maxw;
toolbar->button_maxh = button_maxh;
}

View file

@ -1,55 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Nautilus
*
* Copyright (C) 2000 Eazel, Inc.
*
* Nautilus is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* Nautilus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Andy Hertzfeld <andy@eazel.com>
*/
/* nautilus-toolbar.h - Toolbar for Nautilus that overcomes fixed spacing problem
*/
#ifndef NAUTILUS_TOOLBAR_H
#define NAUTILUS_TOOLBAR_H
#include <gtk/gtktoolbar.h>
#define NAUTILUS_TYPE_TOOLBAR (nautilus_toolbar_get_type ())
#define NAUTILUS_TOOLBAR(obj) \
GTK_CHECK_CAST (obj, NAUTILUS_TYPE_TOOLBAR, NautilusToolbar)
#define NAUTILUS_TOOLBAR_CLASS(klass) \
GTK_CHECK_CLASS_CAST (klass, NAUTILUS_TYPE_TOOLBAR, NautilusToolbarClass)
#define NAUTILUS_IS_TOOLBAR(obj) \
GTK_CHECK_TYPE (obj, NAUTILUS_TYPE_TOOLBAR)
typedef struct NautilusToolbar {
GtkToolbar parent;
int button_spacing;
GtkWidget *throbber;
} NautilusToolbar;
typedef struct {
GtkToolbarClass parent_class;
} NautilusToolbarClass;
GtkType nautilus_toolbar_get_type (void);
GtkWidget* nautilus_toolbar_new (void);
void nautilus_toolbar_set_button_spacing (NautilusToolbar *toolbar, int spacing);
void nautilus_toolbar_set_throbber (NautilusToolbar *toolbar, GtkWidget *throbber);
#endif /* NAUTILUS_TOOLBAR_H */

View file

@ -30,7 +30,6 @@
#include "nautilus-application.h"
#include "nautilus-throbber.h"
#include "nautilus-toolbar.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h"
#include "nautilus-window.h"