[gthumb: 16/23] contact_sheet: allow to edit, create and delete themes
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 16/23] contact_sheet: allow to edit, create and delete themes
- Date: Sun, 26 Dec 2010 19:21:04 +0000 (UTC)
commit c282f413104f164be98f6339288b83b392cc55ee
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Dec 25 21:52:56 2010 +0100
contact_sheet: allow to edit, create and delete themes
extensions/contact_sheet/Makefile.am | 34 +-
.../data/contact_sheet_themes/default.cst | 5 +-
.../data/gthumb_contact_sheet.schemas.in | 2 +-
.../contact_sheet/data/ui/contact-sheet-creator.ui | 24 +-
.../data/ui/contact-sheet-theme-properties.ui | 1126 ++++++++++----------
extensions/contact_sheet/dlg-contact-sheet.c | 375 ++++++--
.../contact_sheet/gth-contact-sheet-theme-dialog.c | 267 +++++
.../contact_sheet/gth-contact-sheet-theme-dialog.h | 57 +
extensions/contact_sheet/gth-contact-sheet-theme.c | 94 ++-
extensions/contact_sheet/gth-contact-sheet-theme.h | 34 +-
gthumb/gio-utils.c | 3 +-
11 files changed, 1321 insertions(+), 700 deletions(-)
---
diff --git a/extensions/contact_sheet/Makefile.am b/extensions/contact_sheet/Makefile.am
index bd768b5..0b808d9 100644
--- a/extensions/contact_sheet/Makefile.am
+++ b/extensions/contact_sheet/Makefile.am
@@ -7,13 +7,14 @@ ENUM_TYPES = \
enum-types.h \
enum-types.c
-HEADER_FILES = \
- actions.h \
- callbacks.h \
- dlg-contact-sheet.h \
- gth-contact-sheet-creator.h \
- gth-contact-sheet-theme.h \
- preferences.h \
+HEADER_FILES = \
+ actions.h \
+ callbacks.h \
+ dlg-contact-sheet.h \
+ gth-contact-sheet-creator.h \
+ gth-contact-sheet-theme.h \
+ gth-contact-sheet-theme-dialog.h \
+ preferences.h \
$(NULL)
enum-types.h: $(HEADER_FILES) $(GLIB_MKENUMS)
@@ -37,15 +38,16 @@ enum-types.c: $(HEADER_FILES) enum-types.h
&& (cmp -s xgen-$(@F) enum-types.c || cp xgen-$(@F) enum-types.c ) \
&& rm -f xgen-$(@F) )
-libcontact_sheet_la_SOURCES = \
- $(ENUM_TYPES) \
- $(HEADER_FILES) \
- actions.c \
- callbacks.c \
- dlg-contact-sheet.c \
- gth-contact-sheet-creator.c \
- gth-contact-sheet-theme.c \
- main.c \
+libcontact_sheet_la_SOURCES = \
+ $(ENUM_TYPES) \
+ $(HEADER_FILES) \
+ actions.c \
+ callbacks.c \
+ dlg-contact-sheet.c \
+ gth-contact-sheet-creator.c \
+ gth-contact-sheet-theme.c \
+ gth-contact-sheet-theme-dialog.c \
+ main.c \
$(NULL)
if RUN_IN_PLACE
diff --git a/extensions/contact_sheet/data/contact_sheet_themes/default.cst b/extensions/contact_sheet/data/contact_sheet_themes/default.cst
index 7f09dab..700e5f6 100644
--- a/extensions/contact_sheet/data/contact_sheet_themes/default.cst
+++ b/extensions/contact_sheet/data/contact_sheet_themes/default.cst
@@ -1,8 +1,5 @@
[Theme]
Name=Default
-Authors=gthumb development team
-Copyright=Copyright © 2010 The Free Software Foundation, Inc.
-Version=1.0
[Background]
Type=full
@@ -12,7 +9,7 @@ Color3=#e8e8ea
Color4=#bad8d8
[Frame]
-Style=slide
+Style=simple-with-shadow
Color=#94d6Cd
[Header]
diff --git a/extensions/contact_sheet/data/gthumb_contact_sheet.schemas.in b/extensions/contact_sheet/data/gthumb_contact_sheet.schemas.in
index 646f5ff..b01df49 100644
--- a/extensions/contact_sheet/data/gthumb_contact_sheet.schemas.in
+++ b/extensions/contact_sheet/data/gthumb_contact_sheet.schemas.in
@@ -84,7 +84,7 @@
<applyto>/apps/gthumb/ext/contact_sheet/theme</applyto>
<owner>gthumb</owner>
<type>string</type>
- <default>default</default>
+ <default>default.cst</default>
<locale name="C">
<short></short>
<long>
diff --git a/extensions/contact_sheet/data/ui/contact-sheet-creator.ui b/extensions/contact_sheet/data/ui/contact-sheet-creator.ui
index 5299471..30c9c6a 100644
--- a/extensions/contact_sheet/data/ui/contact-sheet-creator.ui
+++ b/extensions/contact_sheet/data/ui/contact-sheet-creator.ui
@@ -499,7 +499,7 @@
<property name="follow_state">True</property>
</object>
<attributes>
- <attribute name="pixbuf">3</attribute>
+ <attribute name="pixbuf">2</attribute>
</attributes>
</child>
<child>
@@ -508,7 +508,7 @@
<property name="ellipsize">end</property>
</object>
<attributes>
- <attribute name="text">2</attribute>
+ <attribute name="text">1</attribute>
</attributes>
</child>
</object>
@@ -1061,24 +1061,22 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="theme_liststore">
+ <object class="GtkListStore" id="filetype_liststore">
<columns>
- <!-- column-name index -->
- <column type="gint"/>
- <!-- column-name name -->
+ <!-- column-name default_extension -->
<column type="gchararray"/>
- <!-- column-name display_name -->
+ <!-- column-name mime_type -->
<column type="gchararray"/>
- <!-- column-name preview -->
- <column type="GdkPixbuf"/>
</columns>
</object>
- <object class="GtkListStore" id="filetype_liststore">
+ <object class="GtkListStore" id="theme_liststore">
<columns>
- <!-- column-name default_extension -->
- <column type="gchararray"/>
- <!-- column-name mime_type -->
+ <!-- column-name theme -->
+ <column type="gpointer"/>
+ <!-- column-name display_name -->
<column type="gchararray"/>
+ <!-- column-name preview -->
+ <column type="GdkPixbuf"/>
</columns>
</object>
</interface>
diff --git a/extensions/contact_sheet/data/ui/contact-sheet-theme-properties.ui b/extensions/contact_sheet/data/ui/contact-sheet-theme-properties.ui
index acf1e5f..3557e1b 100644
--- a/extensions/contact_sheet/data/ui/contact-sheet-theme-properties.ui
+++ b/extensions/contact_sheet/data/ui/contact-sheet-theme-properties.ui
@@ -2,49 +2,90 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkDialog" id="theme_properties_dialog">
- <property name="border_width">5</property>
- <property name="resizable">False</property>
- <property name="type_hint">normal</property>
- <property name="has_separator">False</property>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
+ <object class="GtkListStore" id="frame_style_liststore">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">None</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Simple</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Simple with shadow</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Shadow only</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Slide</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Shadow in</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Shadow out</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkHBox" id="theme_properties">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="spacing">24</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="spacing">2</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Name:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="border_width">6</property>
- <property name="spacing">24</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="spacing">12</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Name:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Background</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
<packing>
<property name="expand">False</property>
@@ -52,526 +93,350 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
- <property name="spacing">12</property>
+ <property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox3">
+ <object class="GtkTable" id="table20">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">5</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label2">
+ <object class="GtkRadioButton" id="solid_color_radiobutton">
+ <property name="label" translatable="yes">_Solid color</property>
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Background</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkRadioButton" id="gradient_radiobutton">
+ <property name="label" translatable="yes">_Gradient</property>
<property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkTable" id="table20">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">5</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkRadioButton" id="solid_color_radiobutton">
- <property name="label" translatable="yes">_Solid color</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="gradient_radiobutton">
- <property name="label" translatable="yes">_Gradient</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">solid_color_radiobutton</property>
- </object>
- <packing>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label100">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="hgrad_checkbutton">
- <property name="label" translatable="yes">_Horizontal:</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label101">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="vgrad_checkbutton">
- <property name="label" translatable="yes">_Vertical:</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="vgrad_swap_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">none</property>
- <child>
- <object class="GtkImage" id="vgrad_swap_image">
- <property name="visible">True</property>
- <property name="stock">gtk-refresh</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="hgrad_swap_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">none</property>
- <child>
- <object class="GtkImage" id="hgrad_swap_image">
- <property name="visible">True</property>
- <property name="stock">gtk-refresh</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="page_bg_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="hgrad_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="hgrad2_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="vgrad_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="vgrad2_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">solid_color_radiobutton</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="label3">
+ <object class="GtkLabel" id="label100">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Frame</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="label" translatable="yes"> </property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment2">
+ <object class="GtkCheckButton" id="h_gradient_checkbutton">
+ <property name="label" translatable="yes">_Horizontal:</property>
<property name="visible">True</property>
- <property name="left_padding">12</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label101">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="v_gradient_checkbutton">
+ <property name="label" translatable="yes">_Vertical:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="v_gradient_swap_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="v_gradient_swap_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-refresh</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="h_gradient_swap_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
<child>
- <object class="GtkTable" id="prop_frame_table">
+ <object class="GtkImage" id="h_gradient_swap_image">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label37">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Style:</property>
- <property name="use_underline">True</property>
- <property name="justify">center</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label35">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">C_olor:</property>
- <property name="use_underline">True</property>
- <property name="justify">center</property>
- <property name="mnemonic_widget">frame_colorpicker</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="frame_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="frame_style_combobox">
- <property name="visible">True</property>
- <property name="model">frame_style_liststore</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
+ <property name="stock">gtk-refresh</property>
</object>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="solid_color_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#ffffffffffff</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="h_gradient_1_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#ffffffffffff</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="h_gradient_2_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#ffff00000000</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
+ <child>
+ <object class="GtkColorButton" id="v_gradient_1_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#00000000ffff</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="v_gradient_2_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#000000000000</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
</child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Frame</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox7">
+ <object class="GtkTable" id="prop_frame_table">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label8">
+ <object class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Other</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="label" translatable="yes">_Style:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment5">
+ <object class="GtkLabel" id="label35">
<property name="visible">True</property>
- <property name="left_padding">12</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">C_olor:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">frame_colorpicker</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="frame_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#000000000000</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="frame_style_combobox">
+ <property name="visible">True</property>
+ <property name="model">frame_style_liststore</property>
+ <property name="active">2</property>
<child>
- <object class="GtkTable" id="table2">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Header:</property>
- <property name="use_underline">True</property>
- <property name="justify">center</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkFontButton" id="header_fontpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a font</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="header_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Footer:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkFontButton" id="footer_fontpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a font</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="footer_colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="title" translatable="yes">Select a color</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- </object>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
<packing>
@@ -581,43 +446,193 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox33">
+ <object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
- <property name="spacing">3</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Text</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="width_request">300</property>
- <property name="height_request">380</property>
+ <object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
+ <property name="left_padding">12</property>
<child>
- <object class="GtkViewport" id="viewport1">
+ <object class="GtkTable" id="table2">
<property name="visible">True</property>
- <property name="resize_mode">queue</property>
- <property name="shadow_type">none</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Header:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkFontButton" id="header_fontpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a font</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="header_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#000000000000</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Footer:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkFontButton" id="footer_fontpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a font</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="footer_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#000000000000</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
<child>
- <object class="GtkDrawingArea" id="prop_thumb_preview">
+ <object class="GtkLabel" id="label4">
<property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Caption:</property>
</object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkFontButton" id="caption_fontpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a font</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="caption_colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="title" translatable="yes">Select a color</property>
+ <property name="color">#000000000000</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
</child>
</object>
</child>
</object>
<packing>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -625,56 +640,47 @@
<property name="position">1</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox33">
+ <property name="visible">True</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="width_request">300</property>
+ <property name="height_request">380</property>
<property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button2">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkButton" id="button1">
- <property name="label">gtk-save</property>
+ <object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <property name="resize_mode">queue</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkDrawingArea" id="prop_thumb_preview">
+ <property name="visible">True</property>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
- <action-widgets>
- <action-widget response="0">button2</action-widget>
- <action-widget response="0">button1</action-widget>
- </action-widgets>
- </object>
- <object class="GtkListStore" id="frame_style_liststore">
- <columns>
- <!-- column-name name -->
- <column type="gchararray"/>
- </columns>
</object>
</interface>
diff --git a/extensions/contact_sheet/dlg-contact-sheet.c b/extensions/contact_sheet/dlg-contact-sheet.c
index 56c3083..e7de1fb 100644
--- a/extensions/contact_sheet/dlg-contact-sheet.c
+++ b/extensions/contact_sheet/dlg-contact-sheet.c
@@ -24,6 +24,7 @@
#include <gtk/gtk.h>
#include "dlg-contact-sheet.h"
#include "gth-contact-sheet-creator.h"
+#include "gth-contact-sheet-theme-dialog.h"
#include "preferences.h"
#define GET_WIDGET(name) _gtk_builder_get_widget (data->builder, (name))
@@ -33,8 +34,7 @@
#define PREVIEW_SIZE 112
enum {
- THEME_COLUMN_IDX,
- THEME_COLUMN_NAME,
+ THEME_COLUMN_THEME,
THEME_COLUMN_DISPLAY_NAME,
THEME_COLUMN_PREVIEW
};
@@ -60,8 +60,6 @@ typedef struct {
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *thumbnail_caption_chooser;
- GList *themes;
- int n_themes;
} DialogData;
@@ -86,8 +84,6 @@ destroy_cb (GtkWidget *widget,
DialogData *data)
{
gth_browser_set_dialog (data->browser, "contact_sheet", NULL);
- g_list_foreach (data->themes, (GFunc) gth_contact_sheet_theme_unref, NULL);
- g_list_free (data->themes);
_g_object_list_unref (data->file_list);
g_object_unref (data->builder);
g_free (data);
@@ -102,31 +98,57 @@ help_clicked_cb (GtkWidget *widget,
}
+static GthContactSheetTheme *
+get_selected_theme (DialogData *data)
+{
+ GthContactSheetTheme *theme;
+ GList *list;
+
+ theme = NULL;
+ list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")));
+ if (list != NULL) {
+ GtkTreePath *path;
+ GtkTreeIter iter;
+
+ path = g_list_first (list)->data;
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter, path);
+ gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter,
+ THEME_COLUMN_THEME, &theme,
+ -1);
+
+ g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (list);
+ }
+
+ return theme;
+}
+
+
static void
ok_clicked_cb (GtkWidget *widget,
DialogData *data)
{
- const char *header;
- const char *footer;
- char *s_value;
- GFile *destination;
- const char *template;
- char *mime_type;
- char *file_extension;
- gboolean create_image_map;
- char *theme_name;
- int theme_idx;
- int images_per_index;
- int single_page;
- int columns;
- GthFileDataSort *sort_type;
- gboolean sort_inverse;
- gboolean same_size;
- int thumbnail_size;
- gboolean squared_thumbnail;
- char *thumbnail_caption;
- GtkTreeIter iter;
- GthTask *task;
+ const char *header;
+ const char *footer;
+ char *s_value;
+ GFile *destination;
+ const char *template;
+ char *mime_type;
+ char *file_extension;
+ gboolean create_image_map;
+ GthContactSheetTheme *theme;
+ char *theme_name;
+ int images_per_index;
+ int single_page;
+ int columns;
+ GthFileDataSort *sort_type;
+ gboolean sort_inverse;
+ gboolean same_size;
+ int thumbnail_size;
+ gboolean squared_thumbnail;
+ char *thumbnail_caption;
+ GtkTreeIter iter;
+ GthTask *task;
/* save the options */
@@ -157,28 +179,9 @@ ok_clicked_cb (GtkWidget *widget,
create_image_map = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("image_map_checkbutton")));
eel_gconf_set_boolean (PREF_CONTACT_SHEET_HTML_IMAGE_MAP, create_image_map);
- theme_name = NULL;
- theme_idx = -1;
- {
- GList *list;
-
- list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")));
- if (list != NULL) {
- GtkTreePath *path;
- GtkTreeIter iter;
-
- path = g_list_first (list)->data;
- gtk_tree_model_get_iter (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter, path);
- gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter,
- THEME_COLUMN_NAME, &theme_name,
- THEME_COLUMN_IDX, &theme_idx,
- -1);
- }
-
- g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (list);
- }
- g_return_if_fail (theme_name != NULL);
+ theme = get_selected_theme (data);
+ g_return_if_fail (theme != NULL);
+ theme_name = g_file_get_basename (theme->file);
eel_gconf_set_string (PREF_CONTACT_SHEET_THEME, theme_name);
images_per_index = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton")));
@@ -223,8 +226,7 @@ ok_clicked_cb (GtkWidget *widget,
gth_contact_sheet_creator_set_filename_template (GTH_CONTACT_SHEET_CREATOR (task), template);
gth_contact_sheet_creator_set_mime_type (GTH_CONTACT_SHEET_CREATOR (task), mime_type, file_extension);
gth_contact_sheet_creator_set_write_image_map (GTH_CONTACT_SHEET_CREATOR (task), create_image_map);
- if (theme_idx >= 0)
- gth_contact_sheet_creator_set_theme (GTH_CONTACT_SHEET_CREATOR (task), g_list_nth_data (data->themes, theme_idx));
+ gth_contact_sheet_creator_set_theme (GTH_CONTACT_SHEET_CREATOR (task), theme);
gth_contact_sheet_creator_set_images_per_index (GTH_CONTACT_SHEET_CREATOR (task), images_per_index);
gth_contact_sheet_creator_set_single_index (GTH_CONTACT_SHEET_CREATOR (task), single_page);
gth_contact_sheet_creator_set_columns (GTH_CONTACT_SHEET_CREATOR (task), columns);
@@ -247,6 +249,14 @@ ok_clicked_cb (GtkWidget *widget,
static void
update_sensitivity (DialogData *data)
{
+ GthContactSheetTheme *theme;
+ gboolean sensitive;
+
+ theme = get_selected_theme (data);
+ sensitive = (theme != NULL) && theme->editable;
+ gtk_widget_set_sensitive (GET_WIDGET ("edit_theme_button"), sensitive);
+ gtk_widget_set_sensitive (GET_WIDGET ("delete_theme_button"), sensitive);
+
gtk_widget_set_sensitive (GET_WIDGET ("images_per_index_spinbutton"), ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton"))));
}
@@ -274,7 +284,8 @@ entry_help_icon_press_cb (GtkEntry *entry,
static void
add_themes_from_dir (DialogData *data,
- GFile *dir)
+ GFile *dir,
+ gboolean editable)
{
GFileEnumerator *enumerator;
GFileInfo *file_info;
@@ -328,20 +339,17 @@ add_themes_from_dir (DialogData *data,
}
theme = gth_contact_sheet_theme_new_from_key_file (key_file);
- theme->name = _g_uri_remove_extension (g_file_info_get_name (file_info));
- data->themes = g_list_prepend (data->themes, theme);
+ theme->file = g_object_ref (file);
+ theme->editable = editable;
preview = gth_contact_sheet_theme_create_preview (theme, PREVIEW_SIZE);
gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("theme_liststore")), &iter);
gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("theme_liststore")), &iter,
- THEME_COLUMN_IDX, data->n_themes,
- THEME_COLUMN_NAME, theme->name,
+ THEME_COLUMN_THEME, theme,
THEME_COLUMN_DISPLAY_NAME, theme->display_name,
THEME_COLUMN_PREVIEW, preview,
-1);
- data->n_themes++;
-
g_object_unref (preview);
g_key_file_free (key_file);
g_free (buffer);
@@ -358,6 +366,7 @@ load_themes (DialogData *data)
{
char *style_path;
GFile *style_dir;
+ int visible_columns;
int col_spacing;
GFile *data_dir;
char *default_theme;
@@ -368,7 +377,7 @@ load_themes (DialogData *data)
style_path = gth_user_dir_get_file (GTH_DIR_DATA, GTHUMB_DIR, "contact_sheet_themes", NULL);
style_dir = g_file_new_for_path (style_path);
- add_themes_from_dir (data, style_dir);
+ add_themes_from_dir (data, style_dir, TRUE);
g_object_unref (style_dir);
g_free (style_path);
@@ -376,49 +385,252 @@ load_themes (DialogData *data)
data_dir = g_file_new_for_path (CONTACT_SHEET_DATADIR);
style_dir = _g_file_get_child (data_dir, "contact_sheet_themes", NULL);
- add_themes_from_dir (data, style_dir);
+ add_themes_from_dir (data, style_dir, FALSE);
g_object_unref (style_dir);
g_object_unref (data_dir);
/**/
- data->themes = g_list_reverse (data->themes);
-
- col_spacing = gtk_icon_view_get_column_spacing (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")));
- gtk_widget_set_size_request (GET_WIDGET ("theme_iconview"), (col_spacing + (PREVIEW_SIZE + col_spacing) * 3), (PREVIEW_SIZE + col_spacing * 2));
+ visible_columns = 3;
+ col_spacing = gtk_icon_view_get_item_padding (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")));
+ gtk_widget_set_size_request (GET_WIDGET ("theme_iconview"),
+ (col_spacing * (visible_columns + 1) + (PREVIEW_SIZE + col_spacing * 2) * visible_columns),
+ (PREVIEW_SIZE + col_spacing * 2));
gtk_widget_realize (GET_WIDGET ("theme_iconview"));
default_theme = eel_gconf_get_string (PREF_CONTACT_SHEET_THEME, DEFAULT_CONTACT_SHEET_THEME);
-
model = GTK_TREE_MODEL (GET_WIDGET ("theme_liststore"));
if (gtk_tree_model_get_iter_first (model, &iter)) {
+ gboolean theme_selected = FALSE;
+
do {
- char *name;
+ GthContactSheetTheme *theme;
+ char *basename;
- gtk_tree_model_get (model, &iter, THEME_COLUMN_NAME, &name, -1);
+ gtk_tree_model_get (model, &iter, THEME_COLUMN_THEME, &theme, -1);
+ basename = g_file_get_basename (theme->file);
- if (g_strcmp0 (name, default_theme) == 0) {
+ if (g_strcmp0 (basename, default_theme) == 0) {
GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter);
gtk_icon_view_select_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path);
gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path, TRUE, 0.5, 0.5);
+ theme_selected = TRUE;
gtk_tree_path_free (path);
- g_free (name);
-
+ g_free (basename);
break;
}
- g_free (name);
+ g_free (basename);
}
while (gtk_tree_model_iter_next (model, &iter));
+
+ if (! theme_selected) {
+ GtkTreePath *path;
+
+ path = gtk_tree_path_new_first ();
+ gtk_icon_view_select_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path);
+
+ gtk_tree_path_free (path);
+ }
}
g_free (default_theme);
}
+static void
+theme_dialog_response_cb (GtkDialog *dialog,
+ int response_id,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ GthContactSheetTheme *theme;
+ gboolean new_theme;
+ void *buffer;
+ gsize buffer_size;
+ GtkTreeIter iter;
+ GdkPixbuf *preview;
+ GtkTreePath *path;
+ GError *error = NULL;
+
+ if (response_id == GTK_RESPONSE_CANCEL) {
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ return;
+ }
+
+ if (response_id != GTK_RESPONSE_OK)
+ return;
+
+ theme = gth_contact_sheet_theme_dialog_get_theme (GTH_CONTACT_SHEET_THEME_DIALOG (dialog));
+ new_theme = theme->file == NULL;
+
+ if (theme->file == NULL) {
+ char *themes_path;
+ GFile *themes_dir;
+
+ gth_user_dir_make_dir_for_file (GTH_DIR_DATA, GTHUMB_DIR, "contact_sheet_themes", "themename.cst", NULL);
+ themes_path = gth_user_dir_get_file (GTH_DIR_DATA, GTHUMB_DIR, "contact_sheet_themes", NULL);
+ themes_dir = g_file_new_for_path (themes_path);
+ theme->file = _g_file_create_unique (themes_dir,
+ theme->display_name,
+ ".cst",
+ &error);
+ if (theme->file == NULL)
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), &error);
+
+ g_object_unref (themes_dir);
+ g_free (themes_path);
+
+ if (theme->file == NULL)
+ return;
+ }
+
+ if (! gth_contact_sheet_theme_to_data (theme, &buffer, &buffer_size, &error)) {
+ g_free (buffer);
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), &error);
+ return;
+ }
+
+ if (! g_write_file (theme->file,
+ FALSE,
+ G_FILE_CREATE_NONE,
+ buffer,
+ buffer_size,
+ NULL,
+ &error))
+ {
+ g_free (buffer);
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), &error);
+ return;
+ }
+
+ g_free (buffer);
+
+ if (! new_theme) {
+ GList *list;
+
+ list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")));
+ if (list != NULL) {
+ GthContactSheetTheme *old_theme;
+
+ path = g_list_first (list)->data;
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter, path);
+ gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter,
+ THEME_COLUMN_THEME, &old_theme,
+ -1);
+ gth_contact_sheet_theme_unref (old_theme);
+ gtk_list_store_remove (GTK_LIST_STORE (GET_WIDGET ("theme_liststore")), &iter);
+
+ g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (list);
+ }
+ }
+
+ preview = gth_contact_sheet_theme_create_preview (theme, PREVIEW_SIZE);
+ gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("theme_liststore")), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("theme_liststore")), &iter,
+ THEME_COLUMN_THEME, theme,
+ THEME_COLUMN_DISPLAY_NAME, theme->display_name,
+ THEME_COLUMN_PREVIEW, preview,
+ -1);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter);
+ gtk_icon_view_select_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path);
+
+ gtk_tree_path_free (path);
+ g_object_unref (preview);
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+
+static void
+edit_theme_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ GthContactSheetTheme *theme;
+ GtkWidget *theme_dialog;
+
+ theme = get_selected_theme (data);
+ if ((theme == NULL) || ! theme->editable)
+ return;
+
+ theme_dialog = gth_contact_sheet_theme_dialog_new (theme);
+ g_signal_connect (theme_dialog,
+ "response",
+ G_CALLBACK (theme_dialog_response_cb),
+ data);
+ gtk_window_set_transient_for (GTK_WINDOW (theme_dialog), GTK_WINDOW (data->dialog));
+ gtk_widget_show (theme_dialog);
+}
+
+
+static void
+add_theme_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ GtkWidget *theme_dialog;
+
+ theme_dialog = gth_contact_sheet_theme_dialog_new (NULL);
+ g_signal_connect (theme_dialog,
+ "response",
+ G_CALLBACK (theme_dialog_response_cb),
+ data);
+ gtk_window_set_transient_for (GTK_WINDOW (theme_dialog), GTK_WINDOW (data->dialog));
+ gtk_widget_show (theme_dialog);
+}
+
+
+static void
+delete_theme_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ GList *list;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ GthContactSheetTheme *theme;
+
+ list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")));
+ if (list == NULL)
+ return;
+
+ path = g_list_first (list)->data;
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter, path);
+ gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("theme_liststore")), &iter,
+ THEME_COLUMN_THEME, &theme,
+ -1);
+
+ if (! theme->editable)
+ return;
+
+ if (theme->file != NULL) {
+ GError *error = NULL;
+
+ if (! g_file_delete (theme->file, NULL, &error))
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not delete the theme"), &error);
+ }
+
+ gth_contact_sheet_theme_unref (theme);
+ gtk_list_store_remove (GTK_LIST_STORE (GET_WIDGET ("theme_liststore")), &iter);
+
+ g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (list);
+}
+
+static void
+theme_iconview_selection_changed_cb (GtkIconView *iconview,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ update_sensitivity (data);
+}
+
+
void
dlg_contact_sheet (GthBrowser *browser,
GList *file_list)
@@ -453,9 +665,6 @@ dlg_contact_sheet (GthBrowser *browser,
gtk_widget_show (data->thumbnail_caption_chooser);
gtk_container_add (GTK_CONTAINER (GET_WIDGET ("thumbnail_caption_scrolledwindow")), data->thumbnail_caption_chooser);
- data->n_themes = 0;
- data->themes = NULL;
-
/* Set widgets data. */
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("header_entry")),
@@ -510,7 +719,7 @@ dlg_contact_sheet (GthBrowser *browser,
load_themes (data);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (GET_WIDGET ("theme_liststore")),
- THEME_COLUMN_NAME,
+ THEME_COLUMN_DISPLAY_NAME,
GTK_SORT_ASCENDING);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton")), eel_gconf_get_integer (PREF_CONTACT_SHEET_IMAGES_PER_PAGE, 25));
@@ -593,6 +802,22 @@ dlg_contact_sheet (GthBrowser *browser,
"toggled",
G_CALLBACK (update_sensitivity),
data);
+ g_signal_connect (GET_WIDGET ("edit_theme_button"),
+ "clicked",
+ G_CALLBACK (edit_theme_button_clicked_cb),
+ data);
+ g_signal_connect (GET_WIDGET ("add_theme_button"),
+ "clicked",
+ G_CALLBACK (add_theme_button_clicked_cb),
+ data);
+ g_signal_connect (GET_WIDGET ("delete_theme_button"),
+ "clicked",
+ G_CALLBACK (delete_theme_button_clicked_cb),
+ data);
+ g_signal_connect (GET_WIDGET ("theme_iconview"),
+ "selection-changed",
+ G_CALLBACK (theme_iconview_selection_changed_cb),
+ data);
/* Run dialog. */
diff --git a/extensions/contact_sheet/gth-contact-sheet-theme-dialog.c b/extensions/contact_sheet/gth-contact-sheet-theme-dialog.c
new file mode 100644
index 0000000..e2e2135
--- /dev/null
+++ b/extensions/contact_sheet/gth-contact-sheet-theme-dialog.c
@@ -0,0 +1,267 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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/>.
+ */
+
+#include <config.h>
+#include <glib/gi18n.h>
+#include "gth-contact-sheet-theme-dialog.h"
+
+#define GET_WIDGET(x) (_gtk_builder_get_widget (self->priv->builder, (x)))
+
+
+static gpointer parent_class = NULL;
+
+
+struct _GthContactSheetThemeDialogPrivate {
+ GtkBuilder *builder;
+ GFile *file;
+};
+
+
+static void
+gth_contact_sheet_theme_dialog_finalize (GObject *object)
+{
+ GthContactSheetThemeDialog *self;
+
+ self = GTH_CONTACT_SHEET_THEME_DIALOG (object);
+
+ _g_object_unref (self->priv->builder);
+ _g_object_unref (self->priv->file);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+gth_contact_sheet_theme_dialog_class_init (GthContactSheetThemeDialogClass *klass)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (GthContactSheetThemeDialogPrivate));
+
+ object_class = (GObjectClass*) klass;
+ object_class->finalize = gth_contact_sheet_theme_dialog_finalize;
+}
+
+
+static void
+gth_contact_sheet_theme_dialog_init (GthContactSheetThemeDialog *self)
+{
+ GtkWidget *content;
+
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_CONTACT_SHEET_THEME_DIALOG, GthContactSheetThemeDialogPrivate);
+ self->priv->builder = _gtk_builder_new_from_file ("contact-sheet-theme-properties.ui", "contact_sheet");
+ self->priv->file = NULL;
+
+ gtk_window_set_title (GTK_WINDOW (self), _("Theme Properties"));
+ gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
+ gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 5);
+ gtk_container_set_border_width (GTK_CONTAINER (self), 5);
+
+ gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("v_gradient_swap_image")), "tool-mirror", GTK_ICON_SIZE_MENU);
+ gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("h_gradient_swap_image")), "tool-mirror", GTK_ICON_SIZE_MENU);
+
+ content = _gtk_builder_get_widget (self->priv->builder, "theme_properties");
+ gtk_container_set_border_width (GTK_CONTAINER (content), 5);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), content, TRUE, TRUE, 0);
+
+ gtk_dialog_add_button (GTK_DIALOG (self),
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG (self),
+ GTK_STOCK_OK,
+ GTK_RESPONSE_OK);
+ gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
+}
+
+
+GType
+gth_contact_sheet_theme_dialog_get_type (void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ static const GTypeInfo g_define_type_info = {
+ sizeof (GthContactSheetThemeDialogClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gth_contact_sheet_theme_dialog_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (GthContactSheetThemeDialog),
+ 0,
+ (GInstanceInitFunc) gth_contact_sheet_theme_dialog_init,
+ NULL
+ };
+ type = g_type_register_static (GTK_TYPE_DIALOG,
+ "GthContactSheetThemeDialog",
+ &g_define_type_info,
+ 0);
+ }
+
+ return type;
+}
+
+
+static void
+update_controls_from_theme (GthContactSheetThemeDialog *self,
+ GthContactSheetTheme *theme)
+{
+ _g_object_unref (self->priv->file);
+ self->priv->file = _g_object_ref (theme->file);
+
+ gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("name_entry")), theme->display_name);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("solid_color_radiobutton")), theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_SOLID);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("gradient_radiobutton")), theme->background_type != GTH_CONTACT_SHEET_BACKGROUND_TYPE_SOLID);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("h_gradient_checkbutton")), (theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_HORIZONTAL) || (theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_FULL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("v_gradient_checkbutton")), (theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_VERTICAL) || (theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_FULL));
+
+ if (theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_SOLID) {
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("solid_color_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_2_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_2_colorpicker")), &theme->background_color1);
+ }
+ else if (theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_FULL) {
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("solid_color_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_2_colorpicker")), &theme->background_color2);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_1_colorpicker")), &theme->background_color3);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_2_colorpicker")), &theme->background_color4);
+ }
+ else {
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("solid_color_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_2_colorpicker")), &theme->background_color2);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_2_colorpicker")), &theme->background_color2);
+ }
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("frame_style_combobox")), theme->frame_style);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("frame_colorpicker")), &theme->frame_color);
+
+ gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("header_fontpicker")), theme->header_font_name);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("header_colorpicker")), &theme->header_color);
+
+ gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("footer_fontpicker")), theme->footer_font_name);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("footer_colorpicker")), &theme->footer_color);
+
+ gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("caption_fontpicker")), theme->caption_font_name);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (GET_WIDGET ("caption_colorpicker")), &theme->caption_color);
+
+}
+
+
+static void
+update_theme_preview (GthContactSheetThemeDialog *self)
+{
+
+}
+
+
+static void
+gth_contact_sheet_theme_dialog_construct (GthContactSheetThemeDialog *self,
+ GthContactSheetTheme *theme)
+{
+ if (theme != NULL)
+ update_controls_from_theme (self, theme);
+ update_theme_preview (self);
+}
+
+
+GtkWidget *
+gth_contact_sheet_theme_dialog_new (GthContactSheetTheme *theme)
+{
+ GthContactSheetThemeDialog *self;
+
+ self = g_object_new (GTH_TYPE_CONTACT_SHEET_THEME_DIALOG, NULL);
+ gth_contact_sheet_theme_dialog_construct (self, theme);
+
+ return (GtkWidget *) self;
+}
+
+
+GthContactSheetTheme *
+gth_contact_sheet_theme_dialog_get_theme (GthContactSheetThemeDialog *self)
+{
+ GthContactSheetTheme *theme;
+
+ theme = gth_contact_sheet_theme_new ();
+ theme->file = _g_object_ref (self->priv->file);
+ theme->display_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("name_entry"))));
+
+ /* background */
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("solid_color_radiobutton")))) {
+ theme->background_type = GTH_CONTACT_SHEET_BACKGROUND_TYPE_SOLID;
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("solid_color_colorpicker")), &theme->background_color1);
+ }
+ else {
+ gboolean h_gradient_active = FALSE;
+ gboolean v_gradient_active = FALSE;
+
+ h_gradient_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("h_gradient_checkbutton")));
+ v_gradient_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("v_gradient_checkbutton")));
+
+ if (h_gradient_active && v_gradient_active) {
+ theme->background_type = GTH_CONTACT_SHEET_BACKGROUND_TYPE_FULL;
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_2_colorpicker")), &theme->background_color2);
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_1_colorpicker")), &theme->background_color3);
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_2_colorpicker")), &theme->background_color4);
+ }
+ else if (h_gradient_active) {
+ theme->background_type = GTH_CONTACT_SHEET_BACKGROUND_TYPE_HORIZONTAL;
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("h_gradient_2_colorpicker")), &theme->background_color2);
+ }
+ else if (v_gradient_active) {
+ theme->background_type = GTH_CONTACT_SHEET_BACKGROUND_TYPE_VERTICAL;
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_1_colorpicker")), &theme->background_color1);
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("v_gradient_2_colorpicker")), &theme->background_color2);
+ }
+ }
+
+ /* frame */
+
+ theme->frame_style = gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("frame_style_combobox")));
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("frame_colorpicker")), &theme->frame_color);
+
+ /* header */
+
+ theme->header_font_name = g_strdup (gtk_font_button_get_font_name (GTK_FONT_BUTTON (GET_WIDGET ("header_fontpicker"))));
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("header_colorpicker")), &theme->header_color);
+
+ /* footer */
+
+ theme->footer_font_name = g_strdup (gtk_font_button_get_font_name (GTK_FONT_BUTTON (GET_WIDGET ("footer_fontpicker"))));
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("footer_colorpicker")), &theme->footer_color);
+
+ /* caption */
+
+ theme->caption_font_name = g_strdup (gtk_font_button_get_font_name (GTK_FONT_BUTTON (GET_WIDGET ("caption_fontpicker"))));
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (GET_WIDGET ("caption_colorpicker")), &theme->caption_color);
+
+ return theme;
+}
diff --git a/extensions/contact_sheet/gth-contact-sheet-theme-dialog.h b/extensions/contact_sheet/gth-contact-sheet-theme-dialog.h
new file mode 100644
index 0000000..eb4ccfa
--- /dev/null
+++ b/extensions/contact_sheet/gth-contact-sheet-theme-dialog.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 GTH_CONTACT_SHEET_THEME_DIALOG_H
+#define GTH_CONTACT_SHEET_THEME_DIALOG_H
+
+#include <gtk/gtk.h>
+#include <gthumb.h>
+#include "gth-contact-sheet-theme.h"
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_CONTACT_SHEET_THEME_DIALOG (gth_contact_sheet_theme_dialog_get_type ())
+#define GTH_CONTACT_SHEET_THEME_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_CONTACT_SHEET_THEME_DIALOG, GthContactSheetThemeDialog))
+#define GTH_CONTACT_SHEET_THEME_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_CONTACT_SHEET_THEME_DIALOG, GthContactSheetThemeDialogClass))
+#define GTH_IS_CONTACT_SHEET_THEME_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_CONTACT_SHEET_THEME_DIALOG))
+#define GTH_IS_CONTACT_SHEET_THEME_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_CONTACT_SHEET_THEME_DIALOG))
+#define GTH_CONTACT_SHEET_THEME_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_CONTACT_SHEET_THEME_DIALOG, GthContactSheetThemeDialogClass))
+
+typedef struct _GthContactSheetThemeDialog GthContactSheetThemeDialog;
+typedef struct _GthContactSheetThemeDialogClass GthContactSheetThemeDialogClass;
+typedef struct _GthContactSheetThemeDialogPrivate GthContactSheetThemeDialogPrivate;
+
+struct _GthContactSheetThemeDialog {
+ GtkDialog parent_instance;
+ GthContactSheetThemeDialogPrivate *priv;
+};
+
+struct _GthContactSheetThemeDialogClass {
+ GtkDialogClass parent_class;
+};
+
+GType gth_contact_sheet_theme_dialog_get_type (void);
+GtkWidget * gth_contact_sheet_theme_dialog_new (GthContactSheetTheme *theme);
+GthContactSheetTheme * gth_contact_sheet_theme_dialog_get_theme (GthContactSheetThemeDialog *self);
+
+G_END_DECLS
+
+#endif /* GTH_CONTACT_SHEET_THEME_DIALOG_H */
diff --git a/extensions/contact_sheet/gth-contact-sheet-theme.c b/extensions/contact_sheet/gth-contact-sheet-theme.c
index fc70da4..405b368 100644
--- a/extensions/contact_sheet/gth-contact-sheet-theme.c
+++ b/extensions/contact_sheet/gth-contact-sheet-theme.c
@@ -44,19 +44,49 @@ _g_key_file_get_color (GKeyFile *key_file,
}
+static void
+_g_key_file_set_color (GKeyFile *key_file,
+ char *group_name,
+ char *key,
+ GdkColor *color)
+{
+ char *color_value;
+
+ color_value = gdk_color_to_string (color);
+ g_key_file_set_string (key_file, group_name, key, color_value);
+
+ g_free (color_value);
+}
+
+
GthContactSheetTheme *
-gth_contact_sheet_theme_new_from_key_file (GKeyFile *key_file)
+gth_contact_sheet_theme_new (void)
{
GthContactSheetTheme *theme;
- char *nick;
theme = g_new0 (GthContactSheetTheme, 1);
theme->ref = 1;
+ theme->frame_hpadding = 8;
+ theme->frame_vpadding = 8;
+ theme->caption_spacing = 3;
+ theme->row_spacing = 15;
+ theme->col_spacing = 15;
+ theme->frame_border = 0;
+ theme->editable = TRUE;
+
+ return theme;
+}
+
+
+GthContactSheetTheme *
+gth_contact_sheet_theme_new_from_key_file (GKeyFile *key_file)
+{
+ GthContactSheetTheme *theme;
+ char *nick;
+
+ theme = gth_contact_sheet_theme_new ();
theme->display_name = g_key_file_get_string (key_file, "Theme", "Name", NULL);
- theme->authors = g_key_file_get_string (key_file, "Theme", "Authors", NULL);
- theme->copyright = g_key_file_get_string (key_file, "Theme", "Copyright", NULL);
- theme->version = g_key_file_get_string (key_file, "Theme", "Version", NULL);
nick = g_key_file_get_string (key_file, "Background", "Type", NULL);
theme->background_type = _g_enum_type_get_value_by_nick (GTH_TYPE_CONTACT_SHEET_BACKGROUND_TYPE, nick)->value;
@@ -72,8 +102,8 @@ gth_contact_sheet_theme_new_from_key_file (GKeyFile *key_file)
g_free (nick);
_g_key_file_get_color (key_file, "Frame", "Color", &theme->frame_color, NULL);
- theme->frame_hpadding = 8 /*g_key_file_get_integer (key_file, "Frame", "HPadding", NULL)*/;
- theme->frame_vpadding = 8 /*g_key_file_get_integer (key_file, "Frame", "VPadding", NULL)*/;
+ /*theme->frame_hpadding = g_key_file_get_integer (key_file, "Frame", "HPadding", NULL);*/
+ /*theme->frame_vpadding = g_key_file_get_integer (key_file, "Frame", "VPadding", NULL);*/
theme->header_font_name = g_key_file_get_string (key_file, "Header", "Font", NULL);
_g_key_file_get_color (key_file, "Header", "Color", &theme->header_color, NULL);
@@ -83,16 +113,52 @@ gth_contact_sheet_theme_new_from_key_file (GKeyFile *key_file)
theme->caption_font_name = g_key_file_get_string (key_file, "Caption", "Font", NULL);
_g_key_file_get_color (key_file, "Caption", "Color", &theme->caption_color, NULL);
- theme->caption_spacing = 3; /* g_key_file_get_integer (key_file, "Caption", "Spacing", NULL); */
-
- theme->row_spacing = 15;
- theme->col_spacing = 15;
- theme->frame_border = 0;
return theme;
}
+gboolean
+gth_contact_sheet_theme_to_data (GthContactSheetTheme *theme,
+ void **buffer,
+ gsize *count,
+ GError **error)
+{
+ GKeyFile *key_file;
+
+ key_file = g_key_file_new ();
+ g_key_file_set_string (key_file, "Theme", "Name", theme->display_name);
+
+ g_key_file_set_string (key_file, "Background", "Type", _g_enum_type_get_value (GTH_TYPE_CONTACT_SHEET_BACKGROUND_TYPE, theme->background_type)->value_nick);
+ _g_key_file_set_color (key_file, "Background", "Color1", &theme->background_color1);
+ if (theme->background_type != GTH_CONTACT_SHEET_BACKGROUND_TYPE_SOLID) {
+ _g_key_file_set_color (key_file, "Background", "Color2", &theme->background_color2);
+ if (theme->background_type == GTH_CONTACT_SHEET_BACKGROUND_TYPE_FULL) {
+ _g_key_file_set_color (key_file, "Background", "Color3", &theme->background_color3);
+ _g_key_file_set_color (key_file, "Background", "Color4", &theme->background_color4);
+ }
+ }
+
+ g_key_file_set_string (key_file, "Frame", "Style", _g_enum_type_get_value (GTH_TYPE_CONTACT_SHEET_FRAME_STYLE, theme->frame_style)->value_nick);
+ _g_key_file_set_color (key_file, "Frame", "Color", &theme->frame_color);
+
+ g_key_file_set_string (key_file, "Header", "Font", theme->header_font_name);
+ _g_key_file_set_color (key_file, "Header", "Color", &theme->header_color);
+
+ g_key_file_set_string (key_file, "Footer", "Font", theme->footer_font_name);
+ _g_key_file_set_color (key_file, "Footer", "Color", &theme->footer_color);
+
+ g_key_file_set_string (key_file, "Caption", "Font", theme->caption_font_name);
+ _g_key_file_set_color (key_file, "Caption", "Color", &theme->caption_color);
+
+ *buffer = g_key_file_to_data (key_file, count, error);
+
+ g_key_file_free (key_file);
+
+ return *error == NULL;
+}
+
+
GthContactSheetTheme *
gth_contact_sheet_theme_ref (GthContactSheetTheme *theme)
{
@@ -108,10 +174,8 @@ gth_contact_sheet_theme_unref (GthContactSheetTheme *theme)
if (theme->ref > 0)
return;
+ _g_object_unref (theme->file);
g_free (theme->display_name);
- g_free (theme->authors);
- g_free (theme->copyright);
- g_free (theme->version);
g_free (theme->header_font_name);
g_free (theme->footer_font_name);
g_free (theme->caption_font_name);
diff --git a/extensions/contact_sheet/gth-contact-sheet-theme.h b/extensions/contact_sheet/gth-contact-sheet-theme.h
index cc31b5b..182b61e 100644
--- a/extensions/contact_sheet/gth-contact-sheet-theme.h
+++ b/extensions/contact_sheet/gth-contact-sheet-theme.h
@@ -46,11 +46,8 @@ typedef enum {
typedef struct {
int ref;
- char *name;
+ GFile *file;
char *display_name;
- char *authors;
- char *copyright;
- char *version;
GthContactSheetBackgroundType background_type;
GdkColor background_color1;
@@ -76,18 +73,25 @@ typedef struct {
int row_spacing;
int col_spacing;
+
+ gboolean editable;
} GthContactSheetTheme;
-GthContactSheetTheme * gth_contact_sheet_theme_new_from_key_file (GKeyFile *key_file);
-GthContactSheetTheme * gth_contact_sheet_theme_ref (GthContactSheetTheme *theme);
-void gth_contact_sheet_theme_unref (GthContactSheetTheme *theme);
-void gth_contact_sheet_theme_paint_background (GthContactSheetTheme *theme,
- cairo_t *cr);
-void gth_contact_sheet_theme_paint_frame (GthContactSheetTheme *theme,
- cairo_t *cr,
- GdkRectangle *frame_rect,
- GdkRectangle *image_rect);
-GdkPixbuf * gth_contact_sheet_theme_create_preview (GthContactSheetTheme *theme,
- int preview_size);
+GthContactSheetTheme * gth_contact_sheet_theme_new (void);
+GthContactSheetTheme * gth_contact_sheet_theme_new_from_key_file (GKeyFile *key_file);
+gboolean gth_contact_sheet_theme_to_data (GthContactSheetTheme *theme,
+ void **buffer,
+ gsize *count,
+ GError **error);
+GthContactSheetTheme * gth_contact_sheet_theme_ref (GthContactSheetTheme *theme);
+void gth_contact_sheet_theme_unref (GthContactSheetTheme *theme);
+void gth_contact_sheet_theme_paint_background (GthContactSheetTheme *theme,
+ cairo_t *cr);
+void gth_contact_sheet_theme_paint_frame (GthContactSheetTheme *theme,
+ cairo_t *cr,
+ GdkRectangle *frame_rect,
+ GdkRectangle *image_rect);
+GdkPixbuf * gth_contact_sheet_theme_create_preview (GthContactSheetTheme *theme,
+ int preview_size);
#endif /* GTH_CONTACT_SHEET_THEME_H */
diff --git a/gthumb/gio-utils.c b/gthumb/gio-utils.c
index 80a1e48..d40f97a 100644
--- a/gthumb/gio-utils.c
+++ b/gthumb/gio-utils.c
@@ -2258,7 +2258,6 @@ _g_file_create_unique (GFile *parent,
int n;
GFileOutputStream *stream = NULL;
- file = g_file_get_child_for_display_name (parent, display_name, &local_error);
n = 0;
do {
char *new_display_name;
@@ -2284,6 +2283,8 @@ _g_file_create_unique (GFile *parent,
while ((stream == NULL) && (local_error == NULL));
if (stream == NULL) {
+ if (error != NULL)
+ *error = local_error;
g_object_unref (file);
file = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]