Commit 1ba788fd authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/actions/dockable-actions.c removed dock-related actions

2005-01-26  Michael Natterer  <mitch@gimp.org>

	* app/actions/dockable-actions.c
	* app/actions/dockable-commands.[ch]: removed dock-related
	actions (show-image-menu, auto-follow-active and move-to-screen).

	* app/actions/dock-actions.c
	* app/actions/dock-commands.[ch]: and added them here.

	* app/menus/menus.c: add the "dock" action group to the
	"<Dockable>" UI Manager.

	* app/widgets/gimphelp-ids.h: reordered to match the new grouping.

	* menus/dockable-menu.xml.in: changed accordingly.
parent ee3d7f87
2005-01-26 Michael Natterer <mitch@gimp.org>
* app/actions/dockable-actions.c
* app/actions/dockable-commands.[ch]: removed dock-related
actions (show-image-menu, auto-follow-active and move-to-screen).
* app/actions/dock-actions.c
* app/actions/dock-commands.[ch]: and added them here.
* app/menus/menus.c: add the "dock" action group to the
"<Dockable>" UI Manager.
* app/widgets/gimphelp-ids.h: reordered to match the new grouping.
* menus/dockable-menu.xml.in: changed accordingly.
2005-01-26 Raphaël Quinet <raphael@gimp.org>
* app/composite/gimp-composite-generic.c: minor doc fix for
......
......@@ -18,8 +18,6 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
......@@ -27,12 +25,10 @@
#include "actions-types.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpdockbook.h"
#include "widgets/gimpdocked.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpimagedock.h"
#include "actions.h"
#include "dock-actions.h"
#include "dock-commands.h"
......@@ -44,7 +40,27 @@ static GimpActionEntry dock_actions[] =
{ "dock-close", GTK_STOCK_CLOSE,
N_("Close Dock"), "<control>W", NULL,
G_CALLBACK (dock_close_cmd_callback),
GIMP_HELP_DOCK_CLOSE }
GIMP_HELP_DOCK_CLOSE },
{ "dock-move-to-screen", GIMP_STOCK_MOVE_TO_SCREEN,
N_("M_ove to Screen..."), NULL, NULL,
G_CALLBACK (dock_change_screen_cmd_callback),
GIMP_HELP_DOCK_CHANGE_SCREEN }
};
static GimpToggleActionEntry dock_toggle_actions[] =
{
{ "dock-show-image-menu", NULL,
N_("_Show Image Selection"), NULL, NULL,
G_CALLBACK (dock_toggle_image_menu_cmd_callback),
TRUE,
GIMP_HELP_DOCK_IMAGE_MENU },
{ "dock-auto-follow-active", NULL,
N_("Auto _Follow Active Image"), NULL, NULL,
G_CALLBACK (dock_toggle_auto_cmd_callback),
TRUE,
GIMP_HELP_DOCK_AUTO_BUTTON }
};
......@@ -54,10 +70,45 @@ dock_actions_setup (GimpActionGroup *group)
gimp_action_group_add_actions (group,
dock_actions,
G_N_ELEMENTS (dock_actions));
gimp_action_group_add_toggle_actions (group,
dock_toggle_actions,
G_N_ELEMENTS (dock_toggle_actions));
}
void
dock_actions_update (GimpActionGroup *group,
gpointer data)
{
GtkWidget *widget = action_data_get_widget (data);
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
gint n_screens = 1;
#define SET_ACTIVE(action,active) \
gimp_action_group_set_action_active (group, action, (active) != 0)
#define SET_VISIBLE(action,active) \
gimp_action_group_set_action_visible (group, action, (active) != 0)
n_screens = gdk_display_get_n_screens (gtk_widget_get_display (toplevel));
if (GIMP_IS_IMAGE_DOCK (toplevel))
{
GimpImageDock *image_dock = GIMP_IMAGE_DOCK (toplevel);
SET_VISIBLE ("dock-show-image-menu", TRUE);
SET_VISIBLE ("dock-auto-follow-active", TRUE);
SET_ACTIVE ("dock-show-image-menu", image_dock->show_image_menu);
SET_ACTIVE ("dock-auto-follow-active", image_dock->auto_follow_active);
}
else
{
SET_VISIBLE ("dock-show-image-menu", FALSE);
SET_VISIBLE ("dock-auto-follow-active", FALSE);
}
SET_VISIBLE ("dock-move-to-screen", n_screens > 1);
#undef SET_ACTIVE
#undef SET_VISIBLE
}
......@@ -20,12 +20,25 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "widgets/gimpimagedock.h"
#include "actions.h"
#include "dock-commands.h"
/* local function prototypes */
static void dock_change_screen_confirm_callback (GtkWidget *dialog,
gint value,
gpointer data);
static void dock_change_screen_destroy_callback (GtkWidget *dialog,
GtkWidget *dock);
/* public functions */
void
......@@ -49,3 +62,108 @@ dock_close_cmd_callback (GtkAction *action,
gdk_event_free (event);
}
}
void
dock_change_screen_cmd_callback (GtkAction *action,
gpointer data)
{
GtkWidget *widget;
GtkWidget *toplevel;
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *dialog;
return_if_no_widget (widget, data);
toplevel = gtk_widget_get_toplevel (widget);
dialog = g_object_get_data (G_OBJECT (toplevel), "gimp-change-screen-dialog");
if (dialog)
{
gtk_window_present (GTK_WINDOW (dialog));
return;
}
screen = gtk_widget_get_screen (toplevel);
display = gtk_widget_get_display (toplevel);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
dialog = gimp_query_int_box ("Move Dock to Screen",
toplevel,
NULL, NULL,
"Enter destination screen",
cur_screen, 0, num_screens - 1,
G_OBJECT (toplevel), "destroy",
dock_change_screen_confirm_callback,
toplevel);
g_object_set_data (G_OBJECT (toplevel), "gimp-change-screen-dialog", dialog);
g_signal_connect (dialog, "destroy",
G_CALLBACK (dock_change_screen_destroy_callback),
toplevel);
gtk_widget_show (dialog);
}
void
dock_toggle_image_menu_cmd_callback (GtkAction *action,
gpointer data)
{
GtkWidget *widget;
GtkWidget *toplevel;
gboolean active;
return_if_no_widget (widget, data);
toplevel = gtk_widget_get_toplevel (widget);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (GIMP_IS_IMAGE_DOCK (toplevel))
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (toplevel), active);
}
void
dock_toggle_auto_cmd_callback (GtkAction *action,
gpointer data)
{
GtkWidget *widget;
GtkWidget *toplevel;
gboolean active;
return_if_no_widget (widget, data);
toplevel = gtk_widget_get_toplevel (widget);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (GIMP_IS_IMAGE_DOCK (toplevel))
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (toplevel), active);
}
/* private functions */
static void
dock_change_screen_confirm_callback (GtkWidget *dialog,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
dock_change_screen_destroy_callback (GtkWidget *dialog,
GtkWidget *dock)
{
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL);
}
......@@ -20,8 +20,15 @@
#define __DOCK_COMMANDS_H__
void dock_close_cmd_callback (GtkAction *action,
gpointer data);
void dock_close_cmd_callback (GtkAction *action,
gpointer data);
void dock_change_screen_cmd_callback (GtkAction *action,
gpointer data);
void dock_toggle_image_menu_cmd_callback (GtkAction *action,
gpointer data);
void dock_toggle_auto_cmd_callback (GtkAction *action,
gpointer data);
#endif /* __DOCK_COMMANDS_H__ */
......@@ -30,11 +30,11 @@
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
#include "widgets/gimpdocked.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpimagedock.h"
#include "dialogs-actions.h"
#include "dockable-actions.h"
......@@ -62,27 +62,7 @@ static GimpActionEntry dockable_actions[] =
{ "dockable-detach-tab", GTK_STOCK_CONVERT,
N_("_Detach Tab"), "", NULL,
G_CALLBACK (dockable_detach_tab_cmd_callback),
GIMP_HELP_DOCK_TAB_DETACH },
{ "dockable-move-to-screen", GIMP_STOCK_MOVE_TO_SCREEN,
N_("M_ove to Screen..."), NULL, NULL,
G_CALLBACK (dockable_change_screen_cmd_callback),
GIMP_HELP_DOCK_CHANGE_SCREEN }
};
static GimpToggleActionEntry dockable_toggle_actions[] =
{
{ "dockable-show-image-menu", NULL,
N_("_Show Image Selection"), NULL, NULL,
G_CALLBACK (dockable_toggle_image_menu_cmd_callback),
TRUE,
GIMP_HELP_DOCK_IMAGE_MENU },
{ "dockable-auto-follow-active", NULL,
N_("Auto _Follow Active Image"), NULL, NULL,
G_CALLBACK (dockable_toggle_auto_cmd_callback),
TRUE,
GIMP_HELP_DOCK_AUTO_BUTTON }
GIMP_HELP_DOCK_TAB_DETACH }
};
#define PREVIEW_SIZE(action,label,size) \
......@@ -142,10 +122,6 @@ dockable_actions_setup (GimpActionGroup *group)
dockable_actions,
G_N_ELEMENTS (dockable_actions));
gimp_action_group_add_toggle_actions (group,
dockable_toggle_actions,
G_N_ELEMENTS (dockable_toggle_actions));
gimp_action_group_add_string_actions (group,
dialogs_dockable_actions,
n_dialogs_dockable_actions,
......@@ -184,7 +160,6 @@ dockable_actions_update (GimpActionGroup *group,
GimpViewSize preview_size = -1;
GimpTabStyle tab_style = -1;
gint n_pages = 0;
gint n_screens = 1;
if (GIMP_IS_DOCKBOOK (data))
{
......@@ -334,27 +309,6 @@ dockable_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("dockable-view-type-list", list_view_available);
}
n_screens = gdk_display_get_n_screens
(gtk_widget_get_display (GTK_WIDGET (dockbook->dock)));
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
GimpImageDock *image_dock = GIMP_IMAGE_DOCK (dockbook->dock);
SET_VISIBLE ("dockable-show-image-menu", TRUE);
SET_VISIBLE ("dockable-auto-follow-active", TRUE);
SET_ACTIVE ("dockable-show-image-menu", image_dock->show_image_menu);
SET_ACTIVE ("dockable-auto-follow-active", image_dock->auto_follow_active);
}
else
{
SET_VISIBLE ("dockable-show-image-menu", FALSE);
SET_VISIBLE ("dockable-auto-follow-active", FALSE);
}
SET_VISIBLE ("dockable-move-to-screen", n_screens > 1);
#undef SET_ACTIVE
#undef SET_VISIBLE
#undef SET_SENSITIVE
......
......@@ -39,15 +39,6 @@
#include "dockable-commands.h"
/* local function prototypes */
static void dockable_change_screen_confirm_callback (GtkWidget *dialog,
gint value,
gpointer data);
static void dockable_change_screen_destroy_callback (GtkWidget *dialog,
GtkWidget *dock);
/* public functions */
void
......@@ -275,101 +266,3 @@ dockable_tab_style_cmd_callback (GtkAction *action,
tab_widget);
}
}
void
dockable_toggle_image_menu_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
gboolean active;
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock),
active);
}
void
dockable_toggle_auto_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
gboolean active;
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock),
active);
}
void
dockable_change_screen_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GtkWidget *dock;
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *dialog;
dock = GTK_WIDGET (dockbook->dock);
dialog = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog");
if (dialog)
{
gtk_window_present (GTK_WINDOW (dialog));
return;
}
screen = gtk_widget_get_screen (dock);
display = gtk_widget_get_display (dock);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
dialog = gimp_query_int_box ("Move Dock to Screen",
dock,
NULL, NULL,
"Enter destination screen",
cur_screen, 0, num_screens - 1,
G_OBJECT (dock), "destroy",
dockable_change_screen_confirm_callback,
dock);
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", dialog);
g_signal_connect (dialog, "destroy",
G_CALLBACK (dockable_change_screen_destroy_callback),
dock);
gtk_widget_show (dialog);
}
/* private functions */
static void
dockable_change_screen_confirm_callback (GtkWidget *dialog,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
dockable_change_screen_destroy_callback (GtkWidget *dialog,
GtkWidget *dock)
{
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL);
}
......@@ -20,30 +20,23 @@
#define __DOCKABLE_COMMANDS_H__
void dockable_add_tab_cmd_callback (GtkAction *action,
const gchar *value,
gpointer data);
void dockable_close_tab_cmd_callback (GtkAction *action,
gpointer data);
void dockable_detach_tab_cmd_callback (GtkAction *action,
gpointer data);
void dockable_add_tab_cmd_callback (GtkAction *action,
const gchar *value,
gpointer data);
void dockable_close_tab_cmd_callback (GtkAction *action,
gpointer data);
void dockable_detach_tab_cmd_callback (GtkAction *action,
gpointer data);
void dockable_toggle_view_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void dockable_preview_size_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void dockable_tab_style_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void dockable_toggle_image_menu_cmd_callback (GtkAction *action,
gpointer data);
void dockable_toggle_auto_cmd_callback (GtkAction *action,
gpointer data);
void dockable_change_screen_cmd_callback (GtkAction *action,
gpointer data);
void dockable_toggle_view_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void dockable_preview_size_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void dockable_tab_style_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
#endif /* __DOCKABLE_COMMANDS_H__ */
......@@ -152,6 +152,7 @@ menus_init (Gimp *gimp,
gimp_menu_factory_manager_register (global_menu_factory, "<Dockable>",
"dockable",
"dock",
NULL,
"/dockable-popup",
"dockable-menu.xml", NULL,
......
......@@ -409,6 +409,9 @@
#define GIMP_HELP_DOCK_CLOSE "gimp-dock-close"
#define GIMP_HELP_DOCK_IMAGE_MENU "gimp-dock-image-menu"
#define GIMP_HELP_DOCK_AUTO_BUTTON "gimp-dock-auto-button"
#define GIMP_HELP_DOCK_CHANGE_SCREEN "gimp-dock-change-screen"
#define GIMP_HELP_DOCK_SEPARATOR "gimp-dock-separator"
#define GIMP_HELP_DOCK_TAB_ADD "gimp-dock-tab-add"
#define GIMP_HELP_DOCK_TAB_CLOSE "gimp-dock-tab-close"
#define GIMP_HELP_DOCK_TAB_DETACH "gimp-dock-tab-detach"
......@@ -416,8 +419,6 @@
#define GIMP_HELP_DOCK_TAB_STYLE "gimp-dock-tab-style"
#define GIMP_HELP_DOCK_VIEW_AS_LIST "gimp-dock-view-as-list"
#define GIMP_HELP_DOCK_VIEW_AS_GRID "gimp-dock-view-as-grid"
#define GIMP_HELP_DOCK_CHANGE_SCREEN "gimp-dock-change-screen"
#define GIMP_HELP_DOCK_SEPARATOR "gimp-dock-separator"
#define GIMP_HELP_ABOUT_DIALOG "gimp-about-dialog"
#define GIMP_HELP_COLOR_DIALOG "gimp-color-dialog"
......
......@@ -30,8 +30,8 @@
<menuitem action="dockable-view-type-list" />
<menuitem action="dockable-view-type-grid" />
<separator />
<menuitem action="dockable-show-image-menu" />
<menuitem action="dockable-auto-follow-active" />
<menuitem action="dockable-move-to-screen" />
<menuitem action="dock-show-image-menu" />
<menuitem action="dock-auto-follow-active" />
<menuitem action="dock-move-to-screen" />
</popup>
</ui>
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