brasero r1548 - in trunk: . po src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1548 - in trunk: . po src
- Date: Wed, 19 Nov 2008 14:33:30 +0000 (UTC)
Author: philippr
Date: Wed Nov 19 14:33:29 2008
New Revision: 1548
URL: http://svn.gnome.org/viewvc/brasero?rev=1548&view=rev
Log:
Fix #558213 â There should be a proper name for color picker button.
A new color picker button for toolbars was implemented allowing to set
some text.
* src/Makefile.am:
* src/brasero-jacket-background.c (brasero_jacket_background_init):
* src/brasero-jacket-edit.c
(brasero_jacket_edit_colours_changed_cb),
(brasero_jacket_edit_update_button_state),
(brasero_jacket_edit_init):
* src/brasero-tool-color-picker.c
(brasero_tool_color_picker_set_text),
(brasero_tool_color_picker_get_color),
(brasero_tool_color_picker_set_color),
(brasero_tool_color_picker_expose),
(brasero_tool_color_picker_cancel_clicked),
(brasero_tool_color_picker_ok_clicked),
(brasero_tool_color_picker_clicked),
(brasero_tool_color_picker_init),
(brasero_tool_color_picker_finalize),
(brasero_tool_color_picker_class_init),
(brasero_tool_color_picker_new):
* src/brasero-tool-color-picker.h:
Added:
trunk/src/brasero-tool-color-picker.c
trunk/src/brasero-tool-color-picker.h
Modified:
trunk/ChangeLog
trunk/po/ChangeLog
trunk/po/POTFILES.in
trunk/src/Makefile.am
trunk/src/brasero-jacket-background.c
trunk/src/brasero-jacket-edit.c
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Wed Nov 19 14:33:29 2008
@@ -1,6 +1,7 @@
# List of source files containing translatable strings.
[encoding: UTF-8]
+src/brasero-tool-color-picker.c
src/brasero-video-project.c
src/brasero-pref.c
src/plugins/local-track/burn-uri.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Nov 19 14:33:29 2008
@@ -280,7 +280,9 @@
burn-media.h \
burn-hal-watch.c \
burn-hal-watch.h \
- scsi-test-unit-ready.c
+ scsi-test-unit-ready.c \
+ brasero-tool-color-picker.h \
+ brasero-tool-color-picker.c
if BUILD_INOTIFY
brasero_SOURCES += brasero-file-monitor.c brasero-file-monitor.h
Modified: trunk/src/brasero-jacket-background.c
==============================================================================
--- trunk/src/brasero-jacket-background.c (original)
+++ trunk/src/brasero-jacket-background.c Wed Nov 19 14:33:29 2008
@@ -165,6 +165,7 @@
brasero_jacket_background_init (BraseroJacketBackground *object)
{
BraseroJacketBackgroundPrivate *priv;
+ GtkWidget *table;
GtkWidget *combo;
GtkWidget *hbox2;
GtkWidget *label;
@@ -226,6 +227,7 @@
priv->color2 = gtk_color_button_new ();
gtk_box_pack_start (GTK_BOX (hbox2), priv->color2, FALSE, TRUE, 0);
+ /* second part */
string = g_strdup_printf ("<b>%s</b>", _("_Image"));
label = gtk_label_new_with_mnemonic (string);
g_free (string);
@@ -244,31 +246,43 @@
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- vbox2 = gtk_vbox_new (FALSE, 6);
- gtk_widget_show (vbox2);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
-
- hbox2 = gtk_hbox_new (FALSE, 12);
- gtk_widget_show (hbox2);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ gtk_widget_show (table);
+ gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
label = gtk_label_new (_("Image path:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, TRUE, 0);
+ gtk_table_attach (GTK_TABLE (table),
+ label,
+ 0, 1,
+ 0, 1,
+ GTK_FILL,
+ GTK_FILL,
+ 0, 0);
priv->image = gtk_file_chooser_button_new (_("Choose an image"), GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_widget_show (priv->image);
- gtk_box_pack_start (GTK_BOX (hbox2), priv->image, TRUE, TRUE, 0);
-
- hbox2 = gtk_hbox_new (FALSE, 12);
- gtk_widget_show (hbox2);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0);
+ gtk_table_attach (GTK_TABLE (table),
+ priv->image,
+ 1, 2,
+ 0, 1,
+ GTK_FILL|GTK_EXPAND,
+ GTK_FILL,
+ 0, 0);
label = gtk_label_new (_("Image style:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, TRUE, 0);
+ gtk_table_attach (GTK_TABLE (table),
+ label,
+ 0, 1,
+ 1, 2,
+ GTK_FILL,
+ GTK_FILL,
+ 0, 0);
combo = gtk_combo_box_new_text ();
priv->image_style = combo;
@@ -277,7 +291,13 @@
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Tiled"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Scaled"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
- gtk_box_pack_start (GTK_BOX (hbox2), combo, FALSE, TRUE, 0);
+ gtk_table_attach (GTK_TABLE (table),
+ priv->image_style,
+ 1, 2,
+ 1, 2,
+ GTK_FILL|GTK_EXPAND,
+ GTK_FILL,
+ 0, 0);
gtk_dialog_add_button (GTK_DIALOG (object),
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
Modified: trunk/src/brasero-jacket-edit.c
==============================================================================
--- trunk/src/brasero-jacket-edit.c (original)
+++ trunk/src/brasero-jacket-edit.c Wed Nov 19 14:33:29 2008
@@ -34,6 +34,7 @@
#include "brasero-jacket-view.h"
#include "brasero-jacket-font.h"
#include "brasero-utils.h"
+#include "brasero-tool-color-picker.h"
#include "burn-track.h"
@@ -68,7 +69,6 @@
SNAP_NUM_COL
};
-
G_DEFINE_TYPE (BraseroJacketEdit, brasero_jacket_edit, GTK_TYPE_VBOX);
static void
@@ -333,7 +333,7 @@
if (!priv->current_view)
return;
- gtk_color_button_get_color (button, &color);
+ brasero_tool_color_picker_get_color (BRASERO_TOOL_COLOR_PICKER (button), &color);
buffer = brasero_jacket_view_get_active_buffer (BRASERO_JACKET_VIEW (priv->current_view));
tag = gtk_text_buffer_create_tag (buffer, NULL,
@@ -433,7 +433,7 @@
attributes = brasero_jacket_view_get_default_attributes (BRASERO_JACKET_VIEW (priv->current_view));
gtk_text_iter_get_attributes (&iter, attributes);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->colours), &attributes->appearance.fg_color);
+ brasero_tool_color_picker_set_color (BRASERO_TOOL_COLOR_PICKER (priv->colours), &attributes->appearance.fg_color);
font_name = pango_font_description_to_string (attributes->font);
brasero_jacket_font_set_name (BRASERO_JACKET_FONT (priv->fonts), font_name);
@@ -552,7 +552,9 @@
gtk_widget_show (item);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 0);
- item = GTK_WIDGET (gtk_tool_button_new_from_stock (GTK_STOCK_SELECT_COLOR));
+ item = GTK_WIDGET (gtk_tool_button_new (NULL, _("Bac_kground Properties")));
+ gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "background");
+ gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (item), TRUE);
gtk_widget_show (item);
gtk_widget_set_sensitive (item, FALSE);
g_signal_connect (item,
@@ -645,18 +647,16 @@
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 0);
- priv->colours = gtk_color_button_new ();
- gtk_button_set_focus_on_click (GTK_BUTTON (priv->colours), FALSE);
+ priv->colours = brasero_tool_color_picker_new ();
+ brasero_tool_color_picker_set_text (BRASERO_TOOL_COLOR_PICKER (priv->colours),
+ _("_Text Colour"));
gtk_widget_show (priv->colours);
g_signal_connect (priv->colours,
"color-set",
G_CALLBACK (brasero_jacket_edit_colours_changed_cb),
object);
- item = GTK_WIDGET (gtk_tool_item_new ());
- gtk_widget_show (item);
- gtk_container_add (GTK_CONTAINER (item), priv->colours);
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 1);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (priv->colours), 1);
/* contents */
vbox = gtk_vbox_new (FALSE, 4);
Added: trunk/src/brasero-tool-color-picker.c
==============================================================================
--- (empty file)
+++ trunk/src/brasero-tool-color-picker.c Wed Nov 19 14:33:29 2008
@@ -0,0 +1,245 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * brasero
+ * Copyright (C) Philippe Rouquier 2008 <bonfire-app wanadoo fr>
+ *
+ * brasero 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * brasero 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+
+#include "brasero-tool-color-picker.h"
+
+typedef struct _BraseroToolColorPickerPrivate BraseroToolColorPickerPrivate;
+struct _BraseroToolColorPickerPrivate
+{
+ GtkWidget *dialog;
+
+ GtkWidget *label;
+ GtkWidget *icon;
+
+ GdkColor color;
+};
+
+enum {
+ COLOR_SET_SIGNAL,
+ LAST_SIGNAL,
+};
+static guint tool_color_picker_signals[LAST_SIGNAL] = { 0 };
+
+
+#define BRASERO_TOOL_COLOR_PICKER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TOOL_COLOR_PICKER, BraseroToolColorPickerPrivate))
+
+G_DEFINE_TYPE (BraseroToolColorPicker, brasero_tool_color_picker, GTK_TYPE_TOOL_BUTTON);
+
+void
+brasero_tool_color_picker_set_text (BraseroToolColorPicker *self,
+ const gchar *text)
+{
+ BraseroToolColorPickerPrivate *priv;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (self);
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->label), text);
+}
+
+void
+brasero_tool_color_picker_get_color (BraseroToolColorPicker *self,
+ GdkColor *color)
+{
+ BraseroToolColorPickerPrivate *priv;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (self);
+ color->red = priv->color.red;
+ color->green = priv->color.green;
+ color->blue = priv->color.blue;
+}
+
+void
+brasero_tool_color_picker_set_color (BraseroToolColorPicker *self,
+ GdkColor *color)
+{
+ BraseroToolColorPickerPrivate *priv;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (self);
+ priv->color.red = color->red;
+ priv->color.green = color->green;
+ priv->color.blue = color->blue;
+
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+}
+
+static gboolean
+brasero_tool_color_picker_expose (GtkWidget *widget,
+ GdkEventExpose *event,
+ BraseroToolColorPicker *self)
+{
+ BraseroToolColorPickerPrivate *priv;
+ cairo_t *ctx;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (self);
+
+ ctx = gdk_cairo_create (GDK_DRAWABLE (widget->window));
+ gdk_cairo_set_source_color (ctx, &priv->color);
+ cairo_rectangle (ctx,
+ widget->allocation.x,
+ widget->allocation.y,
+ widget->allocation.width,
+ widget->allocation.height);
+ cairo_fill (ctx);
+ cairo_stroke (ctx);
+ cairo_destroy (ctx);
+
+ return FALSE;
+}
+
+static void
+brasero_tool_color_picker_cancel_clicked (GtkWidget *widget,
+ BraseroToolColorPicker *self)
+{
+ BraseroToolColorPickerPrivate *priv;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (self);
+
+ gtk_widget_destroy (priv->dialog);
+ priv->dialog = NULL;
+}
+
+static void
+brasero_tool_color_picker_ok_clicked (GtkWidget *widget,
+ BraseroToolColorPicker *self)
+{
+ BraseroToolColorPickerPrivate *priv;
+ GtkColorSelection *selection;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (self);
+
+ selection = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (priv->dialog)->colorsel);
+ gtk_color_selection_get_current_color (selection, &priv->color);
+ gtk_widget_destroy (priv->dialog);
+ priv->dialog = NULL;
+
+ gtk_widget_queue_draw (priv->icon);
+
+ g_signal_emit (self,
+ tool_color_picker_signals[COLOR_SET_SIGNAL],
+ 0);
+}
+
+static void
+brasero_tool_color_picker_clicked (BraseroToolColorPicker *self,
+ gpointer NULL_data)
+{
+ GtkWidget *dialog;
+ GtkWidget *toplevel;
+ GtkColorSelection *selection;
+ BraseroToolColorPickerPrivate *priv;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (self);
+
+ dialog = gtk_color_selection_dialog_new (_("Pick a Color"));
+ selection = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel);
+ gtk_color_selection_set_current_color (selection, &priv->color);
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+ if (toplevel && GTK_IS_WINDOW (toplevel)) {
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
+ gtk_window_set_modal (GTK_WINDOW (dialog), gtk_window_get_modal (GTK_WINDOW (toplevel)));
+ }
+
+ g_signal_connect (GTK_COLOR_SELECTION_DIALOG (dialog)->ok_button,
+ "clicked",
+ G_CALLBACK (brasero_tool_color_picker_ok_clicked),
+ self);
+ g_signal_connect (GTK_COLOR_SELECTION_DIALOG (dialog)->cancel_button,
+ "clicked",
+ G_CALLBACK (brasero_tool_color_picker_cancel_clicked),
+ self);
+ g_signal_connect (dialog,
+ "destroy",
+ G_CALLBACK (brasero_tool_color_picker_cancel_clicked),
+ self);
+
+ priv->dialog = dialog;
+ gtk_window_present (GTK_WINDOW (dialog));
+}
+
+static void
+brasero_tool_color_picker_init (BraseroToolColorPicker *object)
+{
+ BraseroToolColorPickerPrivate *priv;
+ GtkWidget *frame;
+
+ priv = BRASERO_TOOL_COLOR_PICKER_PRIVATE (object);
+
+ g_signal_connect (object,
+ "clicked",
+ G_CALLBACK (brasero_tool_color_picker_clicked),
+ NULL);
+
+ priv->label = gtk_label_new_with_mnemonic ("");
+ gtk_widget_show (priv->label);
+ gtk_tool_button_set_label_widget (GTK_TOOL_BUTTON (object), priv->label);
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
+ gtk_widget_show (frame);
+
+ priv->icon = gtk_alignment_new (0.5, 0.5, 1., 1.);
+ gtk_widget_show (priv->icon);
+ g_signal_connect (priv->icon,
+ "expose-event",
+ G_CALLBACK (brasero_tool_color_picker_expose),
+ object);
+ gtk_container_add (GTK_CONTAINER (frame), priv->icon);
+
+ gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (object), frame);
+}
+
+static void
+brasero_tool_color_picker_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (brasero_tool_color_picker_parent_class)->finalize (object);
+}
+
+static void
+brasero_tool_color_picker_class_init (BraseroToolColorPickerClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroToolColorPickerPrivate));
+
+ object_class->finalize = brasero_tool_color_picker_finalize;
+
+ tool_color_picker_signals[COLOR_SET_SIGNAL] =
+ g_signal_new ("color_set",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0,
+ G_TYPE_NONE);
+}
+
+GtkWidget *
+brasero_tool_color_picker_new (void)
+{
+ return g_object_new (BRASERO_TYPE_TOOL_COLOR_PICKER, NULL);
+}
Added: trunk/src/brasero-tool-color-picker.h
==============================================================================
--- (empty file)
+++ trunk/src/brasero-tool-color-picker.h Wed Nov 19 14:33:29 2008
@@ -0,0 +1,66 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * brasero
+ * Copyright (C) Philippe Rouquier 2008 <bonfire-app wanadoo fr>
+ *
+ * brasero 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * brasero 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _BRASERO_TOOL_COLOR_PICKER_H_
+#define _BRASERO_TOOL_COLOR_PICKER_H_
+
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_TOOL_COLOR_PICKER (brasero_tool_color_picker_get_type ())
+#define BRASERO_TOOL_COLOR_PICKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_TOOL_COLOR_PICKER, BraseroToolColorPicker))
+#define BRASERO_TOOL_COLOR_PICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_TOOL_COLOR_PICKER, BraseroToolColorPickerClass))
+#define BRASERO_IS_TOOL_COLOR_PICKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_TOOL_COLOR_PICKER))
+#define BRASERO_IS_TOOL_COLOR_PICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_TOOL_COLOR_PICKER))
+#define BRASERO_TOOL_COLOR_PICKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_TOOL_COLOR_PICKER, BraseroToolColorPickerClass))
+
+typedef struct _BraseroToolColorPickerClass BraseroToolColorPickerClass;
+typedef struct _BraseroToolColorPicker BraseroToolColorPicker;
+
+struct _BraseroToolColorPickerClass
+{
+ GtkToolButtonClass parent_class;
+};
+
+struct _BraseroToolColorPicker
+{
+ GtkToolButton parent_instance;
+};
+
+GType brasero_tool_color_picker_get_type (void) G_GNUC_CONST;
+
+GtkWidget *
+brasero_tool_color_picker_new (void);
+
+void
+brasero_tool_color_picker_set_text (BraseroToolColorPicker *picker,
+ const gchar *text);
+void
+brasero_tool_color_picker_set_color (BraseroToolColorPicker *picker,
+ GdkColor *color);
+void
+brasero_tool_color_picker_get_color (BraseroToolColorPicker *picker,
+ GdkColor *color);
+
+G_END_DECLS
+
+#endif /* _BRASERO_TOOL_COLOR_PICKER_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]