Move the statusbar back to GimpDisplayShell

Keeping it in GimpImageWindow was a bad idea because
- it wasted space
- it produced evil code because
- it conceptually didn't belong there
This commit is contained in:
Michael Natterer 2009-10-04 15:31:38 +02:00
parent 2d3aae3982
commit dee0afed79
14 changed files with 200 additions and 331 deletions

View File

@ -631,13 +631,8 @@ action_message (GimpDisplay *display,
const gchar *format,
...)
{
GimpImageWindow *window;
window = gimp_display_shell_get_window (GIMP_DISPLAY_SHELL (display->shell));
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
const gchar *stock_id = NULL;
va_list args;
@ -657,4 +652,3 @@ action_message (GimpDisplay *display,
stock_id, format, args);
va_end (args);
}
}

View File

@ -429,8 +429,7 @@ gimp_display_new (Gimp *gimp,
gimp_image_window_set_active_shell (window,
GIMP_DISPLAY_SHELL (display->shell));
/* FIXME image window */
g_signal_connect (gimp_image_window_get_statusbar (GIMP_IMAGE_WINDOW (window)),
g_signal_connect (gimp_display_shell_get_statusbar (GIMP_DISPLAY_SHELL (display->shell)),
"cancel",
G_CALLBACK (gimp_display_progress_canceled),
display);

View File

@ -74,8 +74,14 @@ gimp_display_shell_appearance_update (GimpDisplayShell *shell)
window = gimp_display_shell_get_window (shell);
if (window)
appearance_set_action_active (shell, "view-fullscreen",
gimp_image_window_get_fullscreen (window));
{
gboolean fullscreen = gimp_image_window_get_fullscreen (window);
appearance_set_action_active (shell, "view-fullscreen", fullscreen);
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (shell->statusbar),
! fullscreen);
}
gimp_display_shell_set_show_menubar (shell,
options->show_menubar);
@ -136,19 +142,14 @@ gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayOptions *options;
GimpImageWindow *window;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
options = appearance_get_options (shell);
window = gimp_display_shell_get_window (shell);
g_object_set (options, "show-statusbar", show, NULL);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
gimp_image_window_set_show_statusbar (window, show);
}
gimp_statusbar_set_visible (GIMP_STATUSBAR (shell->statusbar), show);
appearance_set_action_active (shell, "view-show-statusbar", show);
}

View File

@ -37,7 +37,6 @@
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-transform.h"
#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
@ -126,7 +125,7 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
gdouble image_x,
gdouble image_y)
{
GimpImageWindow *window;
GimpStatusbar *statusbar;
GimpDialogFactory *factory;
GimpSessionInfo *session_info;
GimpImage *image;
@ -162,14 +161,9 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
/* use the passed image_coords for the statusbar because they are
* possibly snapped...
*/
window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window))
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
statusbar = gimp_display_shell_get_statusbar (shell);
gimp_statusbar_update_cursor (statusbar, precision, image_x, image_y);
}
factory = gimp_dialog_factory_from_name ("dock");
session_info = gimp_dialog_factory_find_session_info (factory,
@ -200,20 +194,15 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
void
gimp_display_shell_clear_cursor (GimpDisplayShell *shell)
{
GimpImageWindow *window;
GimpStatusbar *statusbar;
GimpDialogFactory *factory;
GimpSessionInfo *session_info;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
statusbar = gimp_display_shell_get_statusbar (shell);
gimp_statusbar_clear_cursor (statusbar);
}
factory = gimp_dialog_factory_from_name ("dock");
session_info = gimp_dialog_factory_find_session_info (factory,

View File

@ -586,11 +586,7 @@ gimp_display_shell_saved_handler (GimpImage *image,
const gchar *uri,
GimpDisplayShell *shell)
{
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
gchar *filename = file_utils_uri_display_name (uri);
gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
@ -598,18 +594,13 @@ gimp_display_shell_saved_handler (GimpImage *image,
filename);
g_free (filename);
}
}
static void
gimp_display_shell_exported_handler (GimpImage *image,
const gchar *uri,
GimpDisplayShell *shell)
{
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
gchar *filename = file_utils_uri_display_name (uri);
gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
@ -617,7 +608,6 @@ gimp_display_shell_exported_handler (GimpImage *image,
filename);
g_free (filename);
}
}
static void
gimp_display_shell_vectors_freeze_handler (GimpVectors *vectors,

View File

@ -27,104 +27,74 @@
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-progress.h"
#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
/* FIXME: need to store the shell's progress state in the shell itself
* instead of simply dispatching to the statusbar. Otherwise it's
* impossible to switch an image window between two shells that both
* have active progress messages.
*/
static GimpProgress *
gimp_display_shell_progress_get_real_progress (GimpProgress *progress)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
return GIMP_PROGRESS (statusbar);
}
return NULL;
}
static GimpProgress *
gimp_display_shell_progress_start (GimpProgress *progress,
const gchar *message,
gboolean cancelable)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
return gimp_progress_start (progress, message, cancelable);
return NULL;
return gimp_progress_start (GIMP_PROGRESS (statusbar), message, cancelable);
}
static void
gimp_display_shell_progress_end (GimpProgress *progress)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
gimp_progress_end (progress);
gimp_progress_end (GIMP_PROGRESS (statusbar));
}
static gboolean
gimp_display_shell_progress_is_active (GimpProgress *progress)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
return gimp_progress_is_active (progress);
return FALSE;
return gimp_progress_is_active (GIMP_PROGRESS (statusbar));
}
static void
gimp_display_shell_progress_set_text (GimpProgress *progress,
const gchar *message)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
gimp_progress_set_text (progress, message);
gimp_progress_set_text (GIMP_PROGRESS (statusbar), message);
}
static void
gimp_display_shell_progress_set_value (GimpProgress *progress,
gdouble percentage)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
gimp_progress_set_value (progress, percentage);
gimp_progress_set_value (GIMP_PROGRESS (statusbar), percentage);
}
static gdouble
gimp_display_shell_progress_get_value (GimpProgress *progress)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
return gimp_progress_get_value (progress);
return 0.0;
return gimp_progress_get_value (GIMP_PROGRESS (statusbar));
}
static void
gimp_display_shell_progress_pulse (GimpProgress *progress)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
gimp_progress_pulse (progress);
gimp_progress_pulse (GIMP_PROGRESS (statusbar));
}
static guint32
@ -145,10 +115,9 @@ gimp_display_shell_progress_message (GimpProgress *progress,
const gchar *domain,
const gchar *message)
{
progress = gimp_display_shell_progress_get_real_progress (progress);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
if (progress)
{
switch (severity)
{
case GIMP_MESSAGE_ERROR:
@ -157,21 +126,20 @@ gimp_display_shell_progress_message (GimpProgress *progress,
case GIMP_MESSAGE_WARNING:
/* warning messages go to the statusbar, if it's visible */
if (! gimp_statusbar_get_visible (GIMP_STATUSBAR (progress)))
if (! gimp_statusbar_get_visible (statusbar))
break;
else
return gimp_progress_message (progress, gimp,
return gimp_progress_message (GIMP_PROGRESS (statusbar), gimp,
severity, domain, message);
case GIMP_MESSAGE_INFO:
/* info messages go to the statusbar;
* if they are not handled there, they are swallowed
*/
gimp_progress_message (progress, gimp,
gimp_progress_message (GIMP_PROGRESS (statusbar), gimp,
severity, domain, message);
return TRUE;
}
}
return FALSE;
}

View File

@ -859,10 +859,12 @@ gimp_display_shell_new (GimpDisplay *display,
* | +-- vscrollbar
* |
* +-- lower_hbox
* | |
* | +-- quick_mask
* | +-- hscrollbar
* | +-- navbutton
* |
* +-- quick_mask
* +-- hscrollbar
* +-- navbutton
* +-- statusbar
*/
/* first, set up the container hierarchy *********************************/
@ -1080,6 +1082,14 @@ gimp_display_shell_new (GimpDisplay *display,
_("Navigate the image display"),
GIMP_HELP_IMAGE_WINDOW_NAV_BUTTON);
/* the statusbar ********************************************************/
shell->statusbar = gimp_statusbar_new ();
gimp_statusbar_set_shell (GIMP_STATUSBAR (shell->statusbar), shell);
gimp_help_set_help_data (shell->statusbar, NULL,
GIMP_HELP_IMAGE_WINDOW_STATUS_BAR);
gtk_box_pack_end (GTK_BOX (shell), shell->statusbar, FALSE, FALSE, 0);
/* pack all the widgets **************************************************/
/* fill the inner_table */
@ -1139,6 +1149,8 @@ gimp_display_shell_new (GimpDisplay *display,
gimp_help_set_help_data (shell->canvas,
_("Drop image files here to open them"),
NULL);
gimp_statusbar_empty (GIMP_STATUSBAR (shell->statusbar));
}
/* make sure the information is up-to-date */
@ -1156,6 +1168,14 @@ gimp_display_shell_get_window (GimpDisplayShell *shell)
GIMP_TYPE_IMAGE_WINDOW));
}
GimpStatusbar *
gimp_display_shell_get_statusbar (GimpDisplayShell *shell)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
return GIMP_STATUSBAR (shell->statusbar);
}
void
gimp_display_shell_reconnect (GimpDisplayShell *shell)
{
@ -1206,6 +1226,8 @@ gimp_display_shell_empty (GimpDisplayShell *shell)
gimp_help_set_help_data (shell->canvas,
_("Drop image files here to open them"), NULL);
gimp_statusbar_empty (GIMP_STATUSBAR (shell->statusbar));
gimp_display_shell_expose_full (shell);
user_context = gimp_get_user_context (shell->display->gimp);
@ -1251,6 +1273,8 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
gimp_help_set_help_data (shell->canvas, NULL, NULL);
gimp_statusbar_fill (GIMP_STATUSBAR (shell->statusbar));
/* A size-allocate will always occur because the scrollbars will
* become visible forcing the canvas to become smaller
*/

View File

@ -135,6 +135,8 @@ struct _GimpDisplayShell
GtkWidget *zoom_button; /* NE: zoom toggle button */
GtkWidget *nav_ebox; /* SE: navigation event box */
GtkWidget *statusbar; /* statusbar */
guchar *render_buf; /* buffer for rendering the image */
guint title_idle_id; /* title update idle ID */
@ -223,6 +225,8 @@ GtkWidget * gimp_display_shell_new (GimpDisplay *display,
GimpImageWindow * gimp_display_shell_get_window (GimpDisplayShell *shell);
GimpStatusbar * gimp_display_shell_get_statusbar (GimpDisplayShell *shell);
void gimp_display_shell_reconnect (GimpDisplayShell *shell);
void gimp_display_shell_empty (GimpDisplayShell *shell);

View File

@ -81,7 +81,6 @@ struct _GimpImageWindowPrivate
GtkWidget *right_hpane;
GtkWidget *notebook;
GtkWidget *right_docks;
GtkWidget *statusbar;
GdkWindowState window_state;
gboolean is_empty;
@ -142,9 +141,6 @@ static void gimp_image_window_shell_scaled (GimpDisplayShell *she
static void gimp_image_window_shell_title_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window);
static void gimp_image_window_shell_status_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window);
static void gimp_image_window_shell_icon_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window);
@ -319,13 +315,6 @@ gimp_image_window_constructor (GType type,
if (config->single_window_mode)
gtk_widget_show (private->right_docks);
/* Create the statusbar */
private->statusbar = gimp_statusbar_new ();
gimp_help_set_help_data (private->statusbar, NULL,
GIMP_HELP_IMAGE_WINDOW_STATUS_BAR);
gtk_box_pack_end (GTK_BOX (private->main_vbox), private->statusbar,
FALSE, FALSE, 0);
return object;
}
@ -480,14 +469,12 @@ gimp_image_window_window_state_event (GtkWidget *widget,
gtk_widget_set_name (private->menubar,
fullscreen ? "gimp-menubar-fullscreen" : NULL);
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (private->statusbar),
! fullscreen);
gimp_display_shell_appearance_update (shell);
}
if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
{
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
gboolean iconified = gimp_image_window_is_iconified (window);
GIMP_LOG (WM, "Image window '%s' [%p] set %s",
@ -509,10 +496,8 @@ gimp_image_window_window_state_event (GtkWidget *widget,
gimp_dialog_factories_show_with_display ();
}
if (gimp_progress_is_active (GIMP_PROGRESS (private->statusbar)))
if (gimp_progress_is_active (GIMP_PROGRESS (statusbar)))
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (private->statusbar);
if (iconified)
gimp_statusbar_override_window_title (statusbar);
else
@ -529,13 +514,15 @@ gimp_image_window_style_set (GtkWidget *widget,
{
GimpImageWindow *window = GIMP_IMAGE_WINDOW (widget);
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
GimpDisplayShell *shell = gimp_image_window_get_active_shell (window);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
GtkRequisition requisition;
GdkGeometry geometry;
GdkWindowHints geometry_mask;
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
gtk_widget_size_request (private->statusbar, &requisition);
gtk_widget_size_request (GTK_WIDGET (statusbar), &requisition);
geometry.min_height = 23;
@ -579,18 +566,6 @@ gimp_image_window_get_ui_manager (GimpImageWindow *window)
return private->menubar_manager;
}
GimpStatusbar *
gimp_image_window_get_statusbar (GimpImageWindow *window)
{
GimpImageWindowPrivate *private;
g_return_val_if_fail (GIMP_IS_IMAGE_WINDOW (window), FALSE);
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
return GIMP_STATUSBAR (private->statusbar);
}
GimpDockColumns *
gimp_image_window_get_left_docks (GimpImageWindow *window)
{
@ -777,31 +752,6 @@ gimp_image_window_get_show_menubar (GimpImageWindow *window)
return GTK_WIDGET_VISIBLE (private->menubar);
}
void
gimp_image_window_set_show_statusbar (GimpImageWindow *window,
gboolean show)
{
GimpImageWindowPrivate *private;
g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
gimp_statusbar_set_visible (GIMP_STATUSBAR (private->statusbar), show);
}
gboolean
gimp_image_window_get_show_statusbar (GimpImageWindow *window)
{
GimpImageWindowPrivate *private;
g_return_val_if_fail (GIMP_IS_IMAGE_WINDOW (window), FALSE);
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
return GTK_WIDGET_VISIBLE (private->statusbar);
}
void
gimp_image_window_set_show_docks (GimpImageWindow *window,
gboolean show)
@ -942,8 +892,10 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
if (resize)
{
if (width < private->statusbar->requisition.width)
width = private->statusbar->requisition.width;
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (active_shell);
if (width < GTK_WIDGET (statusbar)->requisition.width)
width = GTK_WIDGET (statusbar)->requisition.width;
width = width + border_width;
height = height + border_height;
@ -976,9 +928,10 @@ gimp_image_window_show_tooltip (GimpUIManager *manager,
const gchar *tooltip,
GimpImageWindow *window)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
GimpDisplayShell *shell = gimp_image_window_get_active_shell (window);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
gimp_statusbar_push (GIMP_STATUSBAR (private->statusbar), "menu-tooltip",
gimp_statusbar_push (statusbar, "menu-tooltip",
NULL, "%s", tooltip);
}
@ -986,9 +939,10 @@ static void
gimp_image_window_hide_tooltip (GimpUIManager *manager,
GimpImageWindow *window)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
GimpDisplayShell *shell = gimp_image_window_get_active_shell (window);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
gimp_statusbar_pop (GIMP_STATUSBAR (private->statusbar), "menu-tooltip");
gimp_statusbar_pop (statusbar, "menu-tooltip");
}
static gboolean
@ -1030,12 +984,11 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
g_signal_handlers_disconnect_by_func (private->active_shell,
gimp_image_window_shell_title_notify,
window);
g_signal_handlers_disconnect_by_func (private->active_shell,
gimp_image_window_shell_status_notify,
window);
g_signal_handlers_disconnect_by_func (private->active_shell,
gimp_image_window_shell_icon_notify,
window);
gimp_image_window_hide_tooltip (private->menubar_manager, window);
}
private->active_shell = shell;
@ -1046,18 +999,12 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
G_CALLBACK (gimp_image_window_image_notify),
window);
gimp_statusbar_set_shell (GIMP_STATUSBAR (private->statusbar),
private->active_shell);
g_signal_connect (private->active_shell, "scaled",
G_CALLBACK (gimp_image_window_shell_scaled),
window);
g_signal_connect (private->active_shell, "notify::title",
G_CALLBACK (gimp_image_window_shell_title_notify),
window);
g_signal_connect (private->active_shell, "notify::status",
G_CALLBACK (gimp_image_window_shell_status_notify),
window);
g_signal_connect (private->active_shell, "notify::icon",
G_CALLBACK (gimp_image_window_shell_icon_notify),
window);
@ -1066,8 +1013,6 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
if (! active_display->image)
{
gimp_statusbar_empty (GIMP_STATUSBAR (private->statusbar));
gimp_dialog_factory_add_foreign (private->display_factory,
"gimp-empty-image-window",
GTK_WIDGET (window));
@ -1092,8 +1037,6 @@ gimp_image_window_image_notify (GimpDisplay *display,
gimp_dialog_factory_remove_dialog (private->display_factory,
GTK_WIDGET (window));
gimp_statusbar_fill (GIMP_STATUSBAR (private->statusbar));
}
}
else if (g_list_length (private->shells) == 1)
@ -1129,8 +1072,6 @@ gimp_image_window_image_notify (GimpDisplay *display,
"gimp-empty-image-window",
GTK_WIDGET (window));
gimp_statusbar_empty (GIMP_STATUSBAR (private->statusbar));
gtk_window_unmaximize (GTK_WINDOW (window));
gtk_window_resize (GTK_WINDOW (window), width, height);
}
@ -1163,17 +1104,6 @@ gimp_image_window_shell_title_notify (GimpDisplayShell *shell,
gtk_window_set_title (GTK_WINDOW (window), shell->title);
}
static void
gimp_image_window_shell_status_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
gimp_statusbar_replace (GIMP_STATUSBAR (private->statusbar), "title",
NULL, "%s", shell->status);
}
static void
gimp_image_window_shell_icon_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,

View File

@ -46,7 +46,6 @@ struct _GimpImageWindowClass
GType gimp_image_window_get_type (void) G_GNUC_CONST;
GimpUIManager * gimp_image_window_get_ui_manager (GimpImageWindow *window);
GimpStatusbar * gimp_image_window_get_statusbar (GimpImageWindow *window);
GimpDockColumns * gimp_image_window_get_left_docks (GimpImageWindow *window);
GimpDockColumns * gimp_image_window_get_right_docks (GimpImageWindow *window);

View File

@ -110,6 +110,9 @@ static void gimp_statusbar_scale_activated (GimpScaleComboBox *combo,
GimpStatusbar *statusbar);
static void gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
GimpStatusbar *statusbar);
static void gimp_statusbar_shell_status_notify(GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpStatusbar *statusbar);
static guint gimp_statusbar_get_context_id (GimpStatusbar *statusbar,
const gchar *context);
static gboolean gimp_statusbar_temp_timeout (GimpStatusbar *statusbar);
@ -676,6 +679,10 @@ gimp_statusbar_set_shell (GimpStatusbar *statusbar,
g_signal_handlers_disconnect_by_func (statusbar->shell,
gimp_statusbar_shell_scaled,
statusbar);
g_signal_handlers_disconnect_by_func (statusbar->shell,
gimp_statusbar_shell_status_notify,
statusbar);
}
statusbar->shell = shell;
@ -683,6 +690,10 @@ gimp_statusbar_set_shell (GimpStatusbar *statusbar,
g_signal_connect_object (statusbar->shell, "scaled",
G_CALLBACK (gimp_statusbar_shell_scaled),
statusbar, 0);
g_signal_connect_object (statusbar->shell, "notify::status",
G_CALLBACK (gimp_statusbar_shell_status_notify),
statusbar, 0);
}
gboolean
@ -1427,6 +1438,15 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
gimp_statusbar_clear_cursor (statusbar);
}
static void
gimp_statusbar_shell_status_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpStatusbar *statusbar)
{
gimp_statusbar_replace (statusbar, "title",
NULL, "%s", shell->status);
}
static void
gimp_statusbar_unit_changed (GimpUnitComboBox *combo,
GimpStatusbar *statusbar)

View File

@ -43,7 +43,6 @@
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-render.h"
#include "display/gimpimagewindow.h"
#include "display/gimpstatusbar.h"
#include "tools/gimp-tools.h"
@ -722,17 +721,12 @@ gui_menu_show_tooltip (GimpUIManager *manager,
if (display)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
gimp_statusbar_push (statusbar, "menu-tooltip",
NULL, "%s", tooltip);
}
}
}
static void
gui_menu_hide_tooltip (GimpUIManager *manager,
@ -744,16 +738,11 @@ gui_menu_hide_tooltip (GimpUIManager *manager,
if (display)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
gimp_statusbar_pop (statusbar, "menu-tooltip");
}
}
}
static void
gui_display_changed (GimpContext *context,

View File

@ -44,7 +44,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpimagewindow.h"
#include "display/gimpdisplayshell-appearance.h"
#include "gimpmeasureoptions.h"
#include "gimpmeasuretool.h"
@ -333,10 +333,8 @@ gimp_measure_tool_button_press (GimpTool *tool,
/* create the info window if necessary */
if (! measure->dialog)
{
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (options->use_info_window ||
! gimp_image_window_get_show_statusbar (window))
! gimp_display_shell_get_show_statusbar (shell))
{
measure->dialog = gimp_measure_tool_dialog_new (measure);
g_object_add_weak_pointer (G_OBJECT (measure->dialog),

View File

@ -32,7 +32,6 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-cursor.h"
#include "display/gimpimagewindow.h"
#include "display/gimpstatusbar.h"
#include "gimptool.h"
@ -896,31 +895,24 @@ gimp_tool_push_status (GimpTool *tool,
...)
{
GimpDisplayShell *shell;
GimpImageWindow *window;
const gchar *stock_id;
va_list args;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
g_return_if_fail (format != NULL);
shell = GIMP_DISPLAY_SHELL (display->shell);
window = gimp_display_shell_get_window (shell);
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
const gchar *stock_id;
va_list args;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
va_start (args, format);
gimp_statusbar_push_valist (statusbar,
gimp_statusbar_push_valist (gimp_display_shell_get_statusbar (shell),
G_OBJECT_TYPE_NAME (tool), stock_id,
format, args);
va_end (args);
}
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
@ -937,26 +929,19 @@ gimp_tool_push_status_coords (GimpTool *tool,
const gchar *help)
{
GimpDisplayShell *shell;
GimpImageWindow *window;
const gchar *stock_id;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
shell = GIMP_DISPLAY_SHELL (display->shell);
window = gimp_display_shell_get_window (shell);
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
gimp_statusbar_push_coords (statusbar,
gimp_statusbar_push_coords (gimp_display_shell_get_statusbar (shell),
G_OBJECT_TYPE_NAME (tool), stock_id,
precision, title, x, separator, y,
help);
}
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
@ -971,25 +956,18 @@ gimp_tool_push_status_length (GimpTool *tool,
const gchar *help)
{
GimpDisplayShell *shell;
GimpImageWindow *window;
const gchar *stock_id;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
shell = GIMP_DISPLAY_SHELL (display->shell);
window = gimp_display_shell_get_window (shell);
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
gimp_statusbar_push_length (statusbar,
gimp_statusbar_push_length (gimp_display_shell_get_statusbar (shell),
G_OBJECT_TYPE_NAME (tool), stock_id,
title, axis, value, help);
}
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
@ -1002,31 +980,24 @@ gimp_tool_replace_status (GimpTool *tool,
...)
{
GimpDisplayShell *shell;
GimpImageWindow *window;
const gchar *stock_id;
va_list args;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
g_return_if_fail (format != NULL);
shell = GIMP_DISPLAY_SHELL (display->shell);
window = gimp_display_shell_get_window (shell);
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
const gchar *stock_id;
va_list args;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
va_start (args, format);
gimp_statusbar_replace_valist (statusbar,
gimp_statusbar_replace_valist (gimp_display_shell_get_statusbar (shell),
G_OBJECT_TYPE_NAME (tool), stock_id,
format, args);
va_end (args);
}
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
@ -1037,21 +1008,14 @@ gimp_tool_pop_status (GimpTool *tool,
GimpDisplay *display)
{
GimpDisplayShell *shell;
GimpImageWindow *window;
g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
shell = GIMP_DISPLAY_SHELL (display->shell);
window = gimp_display_shell_get_window (shell);
if (window)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
gimp_statusbar_pop (statusbar,
gimp_statusbar_pop (gimp_display_shell_get_statusbar (shell),
G_OBJECT_TYPE_NAME (tool));
}
tool->status_displays = g_list_remove (tool->status_displays, display);
}