[nautilus-share] Use GtkBuilder instead of Glade
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-share] Use GtkBuilder instead of Glade
- Date: Tue, 21 Jul 2009 23:54:10 +0000 (UTC)
commit 7a64aee943287a0225921cc47dbe301f6c9d4a2e
Author: Chow Loong Jin <hyperair gmail com>
Date: Thu Jul 2 16:24:02 2009 +0800
Use GtkBuilder instead of Glade
configure.in | 5 -
interfaces/Makefile.am | 2 +-
interfaces/share-dialog.glade | 481 -----------------------------------------
interfaces/share-dialog.ui | 301 ++++++++++++++++++++++++++
src/Makefile.am | 3 +-
src/nautilus-share.c | 35 ++--
6 files changed, 323 insertions(+), 504 deletions(-)
---
diff --git a/configure.in b/configure.in
index 71d9773..46e1f8e 100644
--- a/configure.in
+++ b/configure.in
@@ -10,7 +10,6 @@ AC_PROG_INTLTOOL([0.29])
NAUTILUS_REQUIRED=2.10.0
EEL_REQUIRED=2.10.0
GLIB_REQUIRED=2.4.0
-LIBGLADE_REQUIRED=2.4.0
DATADIRNAME=share
@@ -30,7 +29,6 @@ fi
PKG_CHECK_MODULES(NAUTILUS, libnautilus-extension >= $NAUTILUS_REQUIRED libgnomeui-2.0 gnome-vfs-2.0)
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
-PKG_CHECK_MODULES(LIBGLADE, libglade-2.0 >= $LIBGLADE_REQUIRED)
AC_SUBST(NAUTILUS_CFLAGS)
AC_SUBST(NAUTILUS_LIBS)
@@ -38,9 +36,6 @@ AC_SUBST(NAUTILUS_LIBS)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-AC_SUBST(LIBGLADE_CFLAGS)
-AC_SUBST(LIBGLADE_LIBS)
-
dnl ========================================================
dnl Get nautilus extensionsdir
dnl ========================================================
diff --git a/interfaces/Makefile.am b/interfaces/Makefile.am
index cb21a8e..e02be79 100644
--- a/interfaces/Makefile.am
+++ b/interfaces/Makefile.am
@@ -1 +1 @@
-interfaces_DATA = share-dialog.glade
+interfaces_DATA = share-dialog.ui
diff --git a/interfaces/share-dialog.ui b/interfaces/share-dialog.ui
new file mode 100644
index 0000000..caf96d3
--- /dev/null
+++ b/interfaces/share-dialog.ui
@@ -0,0 +1,301 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="logo_image">
+ <property name="visible">True</property>
+ <property name="pixel_size">64</property>
+ <property name="icon_name">folder-remote</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="logo_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><big><b>Folder Sharing</b></big></property>
+ <property name="use_markup">True</property>
+ <property name="justify">center</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="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox_share_name">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="width_request">20</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_share_name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Share _name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_share_name</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </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="GtkEntry" id="entry_share_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</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="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton_share_folder">
+ <property name="label" translatable="yes">Share this _folder</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="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox_share_comment">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="width_request">20</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_share_comment">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Co_mment:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_share_comment</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </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="GtkEntry" id="entry_share_comment">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</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="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton_share_rw_ro">
+ <property name="label" translatable="yes">_Allow others to create and delete files in this folder</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="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="GtkCheckButton" id="checkbutton_share_guest_ok">
+ <property name="label" translatable="yes">_Guest access (for people without a user account)</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="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</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">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_status">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="wrap">True</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHSeparator" id="hseparator2"/>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="sensitive">False</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>
+ <child>
+ <object class="GtkTreeView" id="treeview_share_list">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">1</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHSeparator" id="hseparator3">
+ <property name="sensitive">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button_cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">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>
+ <child>
+ <object class="GtkButton" id="button_apply">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-save</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="position">7</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index 948eacb..8c7c18d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,7 +7,6 @@ libnautilus_share_la_CFLAGS = \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
$(NAUTILUS_CFLAGS) \
- $(LIBGLADE_CFLAGS) \
$(GLIB_CFLAGS)
nautilus_extensiondir=$(NAUTILUS_EXTENSION_DIR)
@@ -21,4 +20,4 @@ libnautilus_share_la_SOURCES = \
shares.h
libnautilus_share_la_LDFLAGS = -module -avoid-version
-libnautilus_share_la_LIBADD = $(GLIB_LIBS) $(NAUTILUS_LIBS) $(LIBGLADE_LIBS)
+libnautilus_share_la_LIBADD = $(GLIB_LIBS) $(NAUTILUS_LIBS)
diff --git a/src/nautilus-share.c b/src/nautilus-share.c
index 783707c..bad476f 100644
--- a/src/nautilus-share.c
+++ b/src/nautilus-share.c
@@ -44,8 +44,6 @@
#include <gtk/gtk.h>
#include <gtk/gtkentry.h>
-#include <glade/glade.h>
-
#include <string.h>
#include <time.h>
@@ -70,7 +68,7 @@ typedef struct {
char *path; /* Full path which is being shared */
NautilusFileInfo *fileinfo; /* Nautilus file to which this page refers */
- GladeXML *xml;
+ GtkBuilder *xml;
GtkWidget *main; /* Widget that holds all the rest. Its "PropertyPage" GObject-data points to this PropertyPage structure */
@@ -688,25 +686,32 @@ create_property_page (NautilusFileInfo *fileinfo)
share_info = NULL;
g_error_free (error);
+ error = NULL;
}
- page->xml = glade_xml_new(INTERFACES_DIR"/share-dialog.glade","vbox1",GETTEXT_PACKAGE);
- page->main = glade_xml_get_widget(page->xml,"vbox1");
+
+ page->xml = gtk_builder_new ();
+ g_assert (gtk_builder_add_from_file (page->xml,
+ INTERFACES_DIR"/share-dialog.ui", &error));
+
+ page->main = GTK_WIDGET (gtk_builder_get_object (page->xml, "vbox1"));
+ g_assert (page->main != NULL);
+
g_object_set_data_full (G_OBJECT (page->main),
"PropertyPage",
page,
free_property_page_cb);
- page->checkbutton_share_folder = glade_xml_get_widget(page->xml,"checkbutton_share_folder");
- page->hbox_share_comment = glade_xml_get_widget(page->xml,"hbox_share_comment");
- page->hbox_share_name = glade_xml_get_widget(page->xml,"hbox_share_name");
- page->checkbutton_share_rw_ro = glade_xml_get_widget(page->xml,"checkbutton_share_rw_ro");
- page->checkbutton_share_guest_ok = glade_xml_get_widget(page->xml,"checkbutton_share_guest_ok");
- page->entry_share_name = glade_xml_get_widget(page->xml,"entry_share_name");
- page->entry_share_comment = glade_xml_get_widget(page->xml,"entry_share_comment");
- page->label_status = glade_xml_get_widget(page->xml,"label_status");
- page->button_cancel = glade_xml_get_widget(page->xml,"button_cancel");
- page->button_apply = glade_xml_get_widget(page->xml,"button_apply");
+ page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->xml,"checkbutton_share_folder"));
+ page->hbox_share_comment = GTK_WIDGET (gtk_builder_get_object (page->xml,"hbox_share_comment"));
+ page->hbox_share_name = GTK_WIDGET (gtk_builder_get_object (page->xml,"hbox_share_name"));
+ page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->xml,"checkbutton_share_rw_ro"));
+ page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->xml,"checkbutton_share_guest_ok"));
+ page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->xml,"entry_share_name"));
+ page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->xml,"entry_share_comment"));
+ page->label_status = GTK_WIDGET (gtk_builder_get_object (page->xml,"label_status"));
+ page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->xml,"button_cancel"));
+ page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->xml,"button_apply"));
/* Sanity check so that we don't screw up the Glade file */
g_assert (page->checkbutton_share_folder != NULL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]