Commit 6017accc authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

don't make "Detach Tab" insensitive if there are other dockbooks in the

2005-09-13  Michael Natterer  <mitch@gimp.org>

	* app/actions/dockable-actions.c (dockable_actions_update): don't
	make "Detach Tab" insensitive if there are other dockbooks in the
	dock.

	* app/widgets/gimpdock.[ch]
	* app/widgets/gimpdockseparator.[ch]: cleanup.
parent 9c3bc6f6
2005-09-13 Michael Natterer <mitch@gimp.org>
* app/actions/dockable-actions.c (dockable_actions_update): don't
make "Detach Tab" insensitive if there are other dockbooks in the
dock.
* app/widgets/gimpdock.[ch]
* app/widgets/gimpdockseparator.[ch]: cleanup.
2005-09-13 Karine Delvare <kdelvare@nerim.net>
* app/tools/gimprectangletool.c: don't modify the rectangle while
......
......@@ -175,6 +175,7 @@ dockable_actions_update (GimpActionGroup *group,
GimpViewSize preview_size = -1;
GimpTabStyle tab_style = -1;
gint n_pages = 0;
gint n_books = 0;
if (GIMP_IS_DOCKBOOK (data))
{
......@@ -237,6 +238,7 @@ dockable_actions_update (GimpActionGroup *group,
tab_style = dockable->tab_style;
n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (dockbook));
n_books = g_list_length (dockbook->dock->dockbooks);
#define SET_ACTIVE(action,active) \
gimp_action_group_set_action_active (group, action, (active) != 0)
......@@ -245,7 +247,7 @@ dockable_actions_update (GimpActionGroup *group,
#define SET_SENSITIVE(action,sensitive) \
gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0)
SET_SENSITIVE ("dockable-detach-tab", n_pages > 1);
SET_SENSITIVE ("dockable-detach-tab", n_pages > 1 || n_books > 1);
SET_VISIBLE ("dockable-preview-size-menu", preview_size != -1);
......@@ -293,9 +295,7 @@ dockable_actions_update (GimpActionGroup *group,
if (n_pages > 1)
{
GimpDockedInterface *docked_iface;
docked_iface = GIMP_DOCKED_GET_INTERFACE (docked);
GimpDockedInterface *docked_iface = GIMP_DOCKED_GET_INTERFACE (docked);
if (tab_style == GIMP_TAB_STYLE_ICON)
SET_ACTIVE ("dockable-tab-style-icon", TRUE);
......
......@@ -34,12 +34,10 @@
#include "core/gimpmarshal.h"
#include "gimpdialogfactory.h"
#include "gimpdnd.h"
#include "gimpdock.h"
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimpdockseparator.h"
#include "gimphelp-ids.h"
#include "gimpmessagebox.h"
#include "gimpmessagedialog.h"
#include "gimpwidgets-utils.h"
......@@ -65,35 +63,35 @@ enum
};
static void gimp_dock_class_init (GimpDockClass *klass);
static void gimp_dock_init (GimpDock *dock);
static void gimp_dock_class_init (GimpDockClass *klass);
static void gimp_dock_init (GimpDock *dock);
static GObject * gimp_dock_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_dock_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dock_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GObject * gimp_dock_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_dock_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dock_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_dock_destroy (GtkObject *object);
static void gimp_dock_destroy (GtkObject *object);
static gboolean gimp_dock_delete_event (GtkWidget *widget,
GdkEventAny *event);
static gboolean gimp_dock_key_press_event (GtkWidget *widget,
GdkEventKey *kevent);
static gboolean gimp_dock_delete_event (GtkWidget *widget,
GdkEventAny *event);
static gboolean gimp_dock_key_press_event (GtkWidget *widget,
GdkEventKey *kevent);
static void gimp_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_dock_real_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_dock_real_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_dock_real_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_dock_real_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static GtkWindowClass *parent_class = NULL;
......@@ -176,8 +174,10 @@ gimp_dock_class_init (GimpDockClass *klass)
GIMP_TYPE_CONTEXT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_DIALOG_FACTORY,
g_param_spec_object ("dialog-factory", NULL, NULL,
g_param_spec_object ("dialog-factory",
NULL, NULL,
GIMP_TYPE_DIALOG_FACTORY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
......@@ -185,8 +185,7 @@ gimp_dock_class_init (GimpDockClass *klass)
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("default-height",
NULL, NULL,
-1,
G_MAXINT,
-1, G_MAXINT,
DEFAULT_DOCK_HEIGHT,
G_PARAM_READABLE));
}
......@@ -198,6 +197,7 @@ gimp_dock_init (GimpDock *dock)
dock->context = NULL;
dock->dialog_factory = NULL;
dock->dockbooks = NULL;
gtk_window_set_role (GTK_WINDOW (dock), "gimp-dock");
gtk_window_set_resizable (GTK_WINDOW (dock), TRUE);
......
......@@ -68,26 +68,26 @@ struct _GimpDockClass
};
GType gimp_dock_get_type (void) G_GNUC_CONST;
void gimp_dock_setup (GimpDock *dock,
const GimpDock *template);
void gimp_dock_set_aux_info (GimpDock *dock,
GList *aux_info);
GList * gimp_dock_get_aux_info (GimpDock *dock);
void gimp_dock_add (GimpDock *dock,
GimpDockable *dockable,
gint book,
gint index);
void gimp_dock_remove (GimpDock *dock,
GimpDockable *dockable);
void gimp_dock_add_book (GimpDock *dock,
GimpDockbook *dockbook,
gint index);
void gimp_dock_remove_book (GimpDock *dock,
GimpDockbook *dockbook);
GType gimp_dock_get_type (void) G_GNUC_CONST;
void gimp_dock_setup (GimpDock *dock,
const GimpDock *template);
void gimp_dock_set_aux_info (GimpDock *dock,
GList *aux_info);
GList * gimp_dock_get_aux_info (GimpDock *dock);
void gimp_dock_add (GimpDock *dock,
GimpDockable *dockable,
gint book,
gint index);
void gimp_dock_remove (GimpDock *dock,
GimpDockable *dockable);
void gimp_dock_add_book (GimpDock *dock,
GimpDockbook *dockbook,
gint index);
void gimp_dock_remove_book (GimpDock *dock,
GimpDockbook *dockbook);
#endif /* __GIMP_DOCK_H__ */
......@@ -42,8 +42,8 @@
#define LABEL_PADDING 4
static void gimp_dock_separator_class_init (GimpDockSeparatorClass *klass);
static void gimp_dock_separator_init (GimpDockSeparator *separator);
static void gimp_dock_separator_class_init (GimpDockSeparatorClass *klass);
static void gimp_dock_separator_init (GimpDockSeparator *separator);
static void gimp_dock_separator_style_set (GtkWidget *widget,
GtkStyle *prev_style);
......@@ -112,8 +112,7 @@ gimp_dock_separator_class_init (GimpDockSeparatorClass *klass)
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("height",
NULL, NULL,
0,
G_MAXINT,
0, G_MAXINT,
DEFAULT_HEIGHT,
G_PARAM_READABLE));
}
......@@ -121,12 +120,13 @@ gimp_dock_separator_class_init (GimpDockSeparatorClass *klass)
static void
gimp_dock_separator_init (GimpDockSeparator *separator)
{
GtkWidget *frame;
separator->dock = NULL;
separator->label = NULL;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (separator), frame);
gtk_widget_show (frame);
separator->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (separator->frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (separator), separator->frame);
gtk_widget_show (separator->frame);
gimp_help_set_help_data (GTK_WIDGET (separator),
_("You can drop dockable dialogs here."),
......@@ -162,8 +162,7 @@ gimp_dock_separator_size_allocate (GtkWidget *widget,
if (separator->label)
{
GtkWidget *frame = GTK_BIN (separator)->child;
gint width = frame->allocation.width - 2 * LABEL_PADDING;
gint width = separator->frame->allocation.width - 2 * LABEL_PADDING;
gtk_widget_set_size_request (separator->label, width, -1);
}
......@@ -222,8 +221,7 @@ gimp_dock_separator_drag_drop (GtkWidget *widget,
if (GIMP_IS_DOCKABLE (source))
dockable = GIMP_DOCKABLE (source);
else
dockable = (GimpDockable *) g_object_get_data (G_OBJECT (source),
"gimp-dockable");
dockable = g_object_get_data (G_OBJECT (source), "gimp-dockable");
if (dockable)
{
......@@ -288,6 +286,8 @@ gimp_dock_separator_new (GimpDock *dock)
{
GimpDockSeparator *separator;
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
separator = g_object_new (GIMP_TYPE_DOCK_SEPARATOR, NULL);
separator->dock = dock;
......@@ -299,12 +299,8 @@ void
gimp_dock_separator_set_show_label (GimpDockSeparator *separator,
gboolean show)
{
GtkWidget *frame;
g_return_if_fail (GIMP_IS_DOCK_SEPARATOR (separator));
frame = GTK_BIN (separator)->child;
if (show && ! separator->label)
{
separator->label =
......@@ -316,12 +312,12 @@ gimp_dock_separator_set_show_label (GimpDockSeparator *separator,
gimp_label_set_attributes (GTK_LABEL (separator->label),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_container_add (GTK_CONTAINER (frame), separator->label);
gtk_container_add (GTK_CONTAINER (separator->frame), separator->label);
gtk_widget_show (separator->label);
}
else if (! show && separator->label)
{
gtk_container_remove (GTK_CONTAINER (frame), separator->label);
gtk_container_remove (GTK_CONTAINER (separator->frame), separator->label);
separator->label = NULL;
}
}
......@@ -41,6 +41,8 @@ struct _GimpDockSeparator
GtkEventBox parent_instance;
GimpDock *dock;
GtkWidget *frame;
GtkWidget *label;
};
......
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