Commit a8343a6c authored by Felix Riemann's avatar Felix Riemann
Browse files

EogPropertiesDialog: Convert to GtkBuilder template

parent b4d04436
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Wed Oct 30 19:22:06 2013 -->
<!-- Generated with glade 3.16.1 -->
<interface>
<!-- interface-requires gtk+ 3.8 -->
<object class="GtkDialog" id="eog_image_properties_dialog">
<requires lib="gtk+" version="3.10"/>
<template class="EogPropertiesDialog" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Image Properties</property>
......@@ -156,6 +156,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">5</property>
<signal name="switch-page" handler="eog_properties_dialog_page_switch" object="EogPropertiesDialog" swapped="no"/>
<child>
<object class="GtkBox" id="general_box">
<property name="visible">True</property>
......@@ -381,6 +382,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="pd_folder_button_clicked_cb" object="EogPropertiesDialog" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -927,6 +929,7 @@
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<signal name="notify::expanded" handler="pd_exif_details_activated_cb" object="EogPropertiesDialog" after="yes" swapped="no"/>
</object>
</child>
</object>
......@@ -992,5 +995,5 @@
<action-widget response="0">next_button</action-widget>
<action-widget response="-7">close_button</action-widget>
</action-widgets>
</object>
</template>
</interface>
......@@ -441,7 +441,7 @@ static void
_details_button_clicked_cb (GtkButton *button, gpointer user_data)
{
EogMetadataSidebarPrivate *priv = EOG_METADATA_SIDEBAR(user_data)->priv;
EogDialog *dlg;
GtkWidget *dlg;
g_return_if_fail (priv->parent_window != NULL);
......@@ -450,7 +450,7 @@ _details_button_clicked_cb (GtkButton *button, gpointer user_data)
g_return_if_fail (dlg != NULL);
eog_properties_dialog_set_page (EOG_PROPERTIES_DIALOG (dlg),
EOG_PROPERTIES_DIALOG_PAGE_DETAILS);
eog_dialog_show (dlg);
gtk_widget_show (dlg);
}
#endif
......
......@@ -106,7 +106,7 @@ struct _EogPropertiesDialogPrivate {
gboolean netbook_mode;
};
G_DEFINE_TYPE_WITH_PRIVATE (EogPropertiesDialog, eog_properties_dialog, EOG_TYPE_DIALOG);
G_DEFINE_TYPE_WITH_PRIVATE (EogPropertiesDialog, eog_properties_dialog, GTK_TYPE_DIALOG);
static void
pd_update_general_tab (EogPropertiesDialog *prop_dlg,
......@@ -397,13 +397,6 @@ pd_exif_details_activated_cb (GtkExpander *expander,
}
#endif
static void
pd_close_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
eog_dialog_hide (EOG_DIALOG (user_data));
}
static void
pd_folder_button_clicked_cb (GtkButton *button, gpointer data)
{
......@@ -411,7 +404,6 @@ pd_folder_button_clicked_cb (GtkButton *button, gpointer data)
GdkScreen *screen;
guint32 timestamp;
if (!priv->folder_button_uri)
return;
......@@ -427,25 +419,12 @@ eog_properties_dialog_page_switch (GtkNotebook *notebook,
gint page_index,
EogPropertiesDialog *prop_dlg)
{
if (prop_dlg->priv->update_page)
prop_dlg->priv->current_page = page_index;
return TRUE;
}
static gint
eog_properties_dialog_delete (GtkWidget *widget,
GdkEventAny *event,
gpointer user_data)
{
g_return_val_if_fail (EOG_IS_PROPERTIES_DIALOG (user_data), FALSE);
eog_dialog_hide (EOG_DIALOG (user_data));
return TRUE;
}
void
eog_properties_dialog_set_netbook_mode (EogPropertiesDialog *dlg,
gboolean enable)
......@@ -552,9 +531,9 @@ eog_properties_dialog_dispose (GObject *object)
}
static void
eog_properties_dialog_class_init (EogPropertiesDialogClass *class)
eog_properties_dialog_class_init (EogPropertiesDialogClass *klass)
{
GObjectClass *g_object_class = (GObjectClass *) class;
GObjectClass *g_object_class = (GObjectClass *) klass;
g_object_class->dispose = eog_properties_dialog_dispose;
g_object_class->set_property = eog_properties_dialog_set_property;
......@@ -578,13 +557,125 @@ eog_properties_dialog_class_init (EogPropertiesDialogClass *class)
FALSE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
gchar* data;
gsize data_size;
g_file_get_contents(g_build_filename (EOG_DATA_DIR, "eog-image-properties-dialog.ui", NULL), &data, &data_size, NULL);
GBytes *bytes = g_bytes_new_static(data, data_size);
gtk_widget_class_set_template((GtkWidgetClass *) klass, bytes);
GtkWidgetClass *wklass = (GtkWidgetClass*) klass;
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
notebook);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
previous_button);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
next_button);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
close_button);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
thumbnail_image);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
general_box);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
name_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
width_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
height_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
type_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
bytes_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
folder_button);
#if HAVE_EXIF
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_aperture_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_exposure_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_focal_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_flash_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_iso_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_metering_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_model_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
exif_date_label);
#endif
#if HAVE_EXEMPI
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
xmp_location_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
xmp_description_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
xmp_keywords_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
xmp_creator_label);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
xmp_rights_label);
#else
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
xmp_box);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
xmp_box_label);
#endif
#ifdef HAVE_METADATA
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
metadata_box);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
metadata_details_expander);
gtk_widget_class_bind_template_child_private(wklass,
EogPropertiesDialog,
metadata_details_box);
gtk_widget_class_bind_template_callback(wklass,
pd_exif_details_activated_cb);
#endif
gtk_widget_class_bind_template_callback(wklass,
eog_properties_dialog_page_switch);
gtk_widget_class_bind_template_callback(wklass,
pd_folder_button_clicked_cb);
}
static void
eog_properties_dialog_init (EogPropertiesDialog *prop_dlg)
{
EogPropertiesDialogPrivate *priv;
GtkWidget *dlg;
#ifndef HAVE_EXEMPI
GtkWidget *xmp_box, *xmp_box_label;
#endif
......@@ -598,70 +689,19 @@ eog_properties_dialog_init (EogPropertiesDialog *prop_dlg)
priv->update_page = FALSE;
eog_dialog_construct (EOG_DIALOG (prop_dlg),
"eog-image-properties-dialog.ui",
"eog_image_properties_dialog");
eog_dialog_get_controls (EOG_DIALOG (prop_dlg),
"eog_image_properties_dialog", &dlg,
"notebook", &priv->notebook,
"previous_button", &priv->previous_button,
"next_button", &priv->next_button,
"close_button", &priv->close_button,
"thumbnail_image", &priv->thumbnail_image,
"general_box", &priv->general_box,
"name_label", &priv->name_label,
"width_label", &priv->width_label,
"height_label", &priv->height_label,
"type_label", &priv->type_label,
"bytes_label", &priv->bytes_label,
"folder_button", &priv->folder_button,
#ifdef HAVE_EXIF
"exif_aperture_label", &priv->exif_aperture_label,
"exif_exposure_label", &priv->exif_exposure_label,
"exif_focal_label", &priv->exif_focal_label,
"exif_flash_label", &priv->exif_flash_label,
"exif_iso_label", &priv->exif_iso_label,
"exif_metering_label", &priv->exif_metering_label,
"exif_model_label", &priv->exif_model_label,
"exif_date_label", &priv->exif_date_label,
#endif
#ifdef HAVE_EXEMPI
"xmp_location_label", &priv->xmp_location_label,
"xmp_description_label", &priv->xmp_description_label,
"xmp_keywords_label", &priv->xmp_keywords_label,
"xmp_creator_label", &priv->xmp_creator_label,
"xmp_rights_label", &priv->xmp_rights_label,
#else
"xmp_box", &xmp_box,
"xmp_box_label", &xmp_box_label,
#endif
#ifdef HAVE_METADATA
"metadata_box", &priv->metadata_box,
"metadata_details_expander", &priv->metadata_details_expander,
"metadata_details_box", &priv->metadata_details_box,
#endif
NULL);
gtk_widget_init_template (GTK_WIDGET (prop_dlg));
g_signal_connect (dlg,
"delete-event",
G_CALLBACK (eog_properties_dialog_delete),
prop_dlg);
g_signal_connect (priv->notebook,
"switch-page",
G_CALLBACK (eog_properties_dialog_page_switch),
g_signal_connect (prop_dlg,
"delete-event",
G_CALLBACK (gtk_widget_hide_on_delete),
prop_dlg);
g_signal_connect (priv->close_button,
"clicked",
G_CALLBACK (pd_close_button_clicked_cb),
prop_dlg);
g_signal_connect_swapped (priv->close_button,
"clicked",
G_CALLBACK (gtk_widget_hide_on_delete),
prop_dlg);
g_signal_connect (priv->folder_button,
"clicked",
G_CALLBACK (pd_folder_button_clicked_cb),
prop_dlg);
gtk_widget_set_tooltip_text (GTK_WIDGET (priv->folder_button),
_("Show the folder which contains this "
"file in the file manager"));
......@@ -698,11 +738,6 @@ eog_properties_dialog_init (EogPropertiesDialog *prop_dlg)
sw);
}
g_signal_connect_after (G_OBJECT (priv->metadata_details_expander),
"notify::expanded",
G_CALLBACK (pd_exif_details_activated_cb),
dlg);
#ifndef HAVE_EXEMPI
gtk_widget_hide (xmp_box);
gtk_widget_hide (xmp_box_label);
......@@ -729,7 +764,7 @@ eog_properties_dialog_init (EogPropertiesDialog *prop_dlg)
*
* Returns: (transfer full) (type EogPropertiesDialog): a new #EogPropertiesDialog
**/
GObject *
GtkWidget *
eog_properties_dialog_new (GtkWindow *parent,
EogThumbView *thumbview,
GtkAction *next_image_action,
......@@ -743,15 +778,18 @@ eog_properties_dialog_new (GtkWindow *parent,
g_return_val_if_fail (GTK_IS_ACTION (previous_image_action), NULL);
prop_dlg = g_object_new (EOG_TYPE_PROPERTIES_DIALOG,
"parent-window", parent,
"thumbview", thumbview,
NULL);
if (parent) {
gtk_window_set_transient_for (GTK_WINDOW (prop_dlg), parent);
}
gtk_activatable_set_related_action (GTK_ACTIVATABLE (EOG_PROPERTIES_DIALOG (prop_dlg)->priv->next_button), next_image_action);
gtk_activatable_set_related_action (GTK_ACTIVATABLE (EOG_PROPERTIES_DIALOG (prop_dlg)->priv->previous_button), previous_image_action);
return prop_dlg;
return GTK_WIDGET (prop_dlg);
}
void
......
......@@ -22,7 +22,6 @@
#ifndef __EOG_PROPERTIES_DIALOG_H__
#define __EOG_PROPERTIES_DIALOG_H__
#include "eog-dialog.h"
#include "eog-image.h"
#include "eog-thumb-view.h"
......@@ -51,19 +50,19 @@ typedef enum {
} EogPropertiesDialogPage;
struct _EogPropertiesDialog {
EogDialog dialog;
GtkDialog dialog;
EogPropertiesDialogPrivate *priv;
};
struct _EogPropertiesDialogClass {
EogDialogClass parent_class;
GtkDialogClass parent_class;
};
GType eog_properties_dialog_get_type (void) G_GNUC_CONST;
GObject *eog_properties_dialog_new (GtkWindow *parent,
EogThumbView *thumbview,
GtkWidget *eog_properties_dialog_new (GtkWindow *parent,
EogThumbView *thumbview,
GtkAction *next_image_action,
GtkAction *previous_image_action);
......
......@@ -141,7 +141,7 @@ struct _EogWindowPrivate {
GtkWidget *nav;
GtkWidget *message_area;
GtkWidget *toolbar;
GObject *properties_dlg;
GtkWidget *properties_dlg;
GtkActionGroup *actions_window;
GtkActionGroup *actions_image;
......@@ -3132,7 +3132,7 @@ eog_window_cmd_print (GtkAction *action, gpointer user_data)
eog_window_print (window);
}
EogDialog*
GtkWidget*
eog_window_get_properties_dialog (EogWindow *window)
{
EogWindowPrivate *priv;
......@@ -3165,17 +3165,17 @@ eog_window_get_properties_dialog (EogWindow *window)
G_SETTINGS_BIND_GET);
}
return EOG_DIALOG (priv->properties_dlg);
return priv->properties_dlg;
}
static void
eog_window_cmd_properties (GtkAction *action, gpointer user_data)
{
EogWindow *window = EOG_WINDOW (user_data);
EogDialog *dialog;
GtkWidget *dialog;
dialog = eog_window_get_properties_dialog (window);
eog_dialog_show (dialog);
gtk_widget_show (dialog);
}
static void
......
......@@ -127,7 +127,7 @@ gboolean eog_window_is_empty (EogWindow *window);
gboolean eog_window_is_not_initializing (const EogWindow *window);
void eog_window_reload_image (EogWindow *window);
EogDialog *eog_window_get_properties_dialog (EogWindow *window);
GtkWidget *eog_window_get_properties_dialog (EogWindow *window);
void eog_window_show_about_dialog (EogWindow *window);
void eog_window_show_preferences_dialog (EogWindow *window);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment