[gimp] app: use a GimpToolGui in GimpColorPickerTool
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: use a GimpToolGui in GimpColorPickerTool
- Date: Fri, 7 Jun 2013 10:13:43 +0000 (UTC)
commit 9b9302b91af7499334b1889f9dfb9e5ebfb74a71
Author: Michael Natterer <mitch gimp org>
Date: Fri Jun 7 12:11:59 2013 +0200
app: use a GimpToolGui in GimpColorPickerTool
app/tools/gimpcolorpickertool.c | 63 ++++++++++++++++++--------------------
app/tools/gimpcolorpickertool.h | 2 +-
2 files changed, 31 insertions(+), 34 deletions(-)
---
diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c
index 3d69292..c817ca1 100644
--- a/app/tools/gimpcolorpickertool.c
+++ b/app/tools/gimpcolorpickertool.c
@@ -32,7 +32,7 @@
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
-#include "display/gimptooldialog.h"
+#include "display/gimptoolgui.h"
#include "gimpcolorpickeroptions.h"
#include "gimpcolorpickertool.h"
@@ -152,11 +152,11 @@ gimp_color_picker_tool_control (GimpTool *tool,
break;
case GIMP_TOOL_ACTION_HALT:
- if (picker_tool->dialog)
+ if (picker_tool->gui)
{
- gtk_widget_destroy (picker_tool->dialog);
+ g_object_unref (picker_tool->gui);
- picker_tool->dialog = NULL;
+ picker_tool->gui = NULL;
picker_tool->color_area = NULL;
picker_tool->color_frame1 = NULL;
picker_tool->color_frame2 = NULL;
@@ -223,7 +223,7 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
gchar *status_help = NULL;
GdkModifierType shift_mod = 0;
- if (! picker_tool->dialog)
+ if (! picker_tool->gui)
shift_mod = GDK_SHIFT_MASK;
switch (options->pick_mode)
@@ -284,10 +284,10 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool,
options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (color_tool);
- if (options->use_info_window && ! picker_tool->dialog)
+ if (options->use_info_window && ! picker_tool->gui)
gimp_color_picker_tool_info_create (picker_tool);
- if (picker_tool->dialog)
+ if (picker_tool->gui)
gimp_color_picker_tool_info_update (picker_tool, sample_format,
color, color_index);
@@ -301,37 +301,39 @@ static void
gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
{
GimpTool *tool = GIMP_TOOL (picker_tool);
- GtkWidget *content_area;
+ GtkWidget *dialog;
+ GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *frame;
GimpRGB color;
g_return_if_fail (tool->drawable != NULL);
- picker_tool->dialog = gimp_tool_dialog_new (tool->tool_info,
- gimp_display_get_shell (tool->display),
- _("Color Picker Information"),
+ picker_tool->gui = gimp_tool_gui_new (tool->tool_info,
+ gimp_display_get_shell (tool->display),
+ _("Color Picker Information"),
+ FALSE,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE,
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE,
- NULL);
+ NULL);
- gtk_window_set_focus_on_map (GTK_WINDOW (picker_tool->dialog), FALSE);
+ dialog = gimp_tool_gui_get_dialog (picker_tool->gui);
+ vbox = gimp_tool_gui_get_vbox (picker_tool->gui);
- gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (picker_tool->dialog),
- GIMP_VIEWABLE (tool->drawable),
- GIMP_CONTEXT (gimp_tool_get_options (tool)));
+ if (GTK_IS_DIALOG (dialog))
+ gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE);
- g_signal_connect (picker_tool->dialog, "response",
+ gimp_tool_gui_set_viewable (picker_tool->gui,
+ GIMP_VIEWABLE (tool->drawable));
+
+ g_signal_connect (dialog, "response",
G_CALLBACK (gimp_color_picker_tool_info_response),
picker_tool);
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (picker_tool->dialog));
-
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
- gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
picker_tool->color_frame1 = gimp_color_frame_new ();
@@ -384,11 +386,10 @@ gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
{
GimpTool *tool = GIMP_TOOL (picker_tool);
- gimp_tool_dialog_set_shell (GIMP_TOOL_DIALOG (picker_tool->dialog),
- gimp_display_get_shell (tool->display));
- gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (picker_tool->dialog),
- GIMP_VIEWABLE (tool->drawable),
- GIMP_CONTEXT (gimp_tool_get_options (tool)));
+ gimp_tool_gui_set_shell (picker_tool->gui,
+ gimp_display_get_shell (tool->display));
+ gimp_tool_gui_set_viewable (picker_tool->gui,
+ GIMP_VIEWABLE (tool->drawable));
gimp_color_area_set_color (GIMP_COLOR_AREA (picker_tool->color_area),
color);
@@ -398,9 +399,5 @@ gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
gimp_color_frame_set_color (GIMP_COLOR_FRAME (picker_tool->color_frame2),
sample_format, color, color_index);
- /* don't use gtk_window_present() because it would focus the dialog */
- if (gtk_widget_get_visible (picker_tool->dialog))
- gdk_window_show (gtk_widget_get_window (picker_tool->dialog));
- else
- gtk_widget_show (picker_tool->dialog);
+ gimp_tool_gui_show (picker_tool->gui);
}
diff --git a/app/tools/gimpcolorpickertool.h b/app/tools/gimpcolorpickertool.h
index 731ff9f..5e710fe 100644
--- a/app/tools/gimpcolorpickertool.h
+++ b/app/tools/gimpcolorpickertool.h
@@ -39,7 +39,7 @@ struct _GimpColorPickerTool
{
GimpColorTool parent_instance;
- GtkWidget *dialog;
+ GimpToolGui *gui;
GtkWidget *color_area;
GtkWidget *color_frame1;
GtkWidget *color_frame2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]