Author: kelnos
Date: 2007-08-18 19:52:49 +0000 (Sat, 18 Aug 2007)
New Revision: 25988
Added:
libxfcegui4/trunk/glade/
libxfcegui4/trunk/glade/16x16/
libxfcegui4/trunk/glade/16x16/Makefile.am
libxfcegui4/trunk/glade/16x16/xfce-app-menu-item.png
libxfcegui4/trunk/glade/16x16/xfce-heading.png
libxfcegui4/trunk/glade/16x16/xfce-movehandler.png
libxfcegui4/trunk/glade/16x16/xfce-scaled-image.png
libxfcegui4/trunk/glade/16x16/xfce-titled-dialog.png
libxfcegui4/trunk/glade/22x22/
libxfcegui4/trunk/glade/22x22/Makefile.am
libxfcegui4/trunk/glade/22x22/xfce-app-menu-item.png
libxfcegui4/trunk/glade/22x22/xfce-heading.png
libxfcegui4/trunk/glade/22x22/xfce-movehandler.png
libxfcegui4/trunk/glade/22x22/xfce-scaled-image.png
libxfcegui4/trunk/glade/22x22/xfce-titled-dialog.png
libxfcegui4/trunk/glade/Makefile.am
libxfcegui4/trunk/glade/glade-xfce4.c
libxfcegui4/trunk/glade/xfce4.xml.in
Modified:
libxfcegui4/trunk/Makefile.am
libxfcegui4/trunk/configure.in.in
libxfcegui4/trunk/libxfcegui4/xfce-appmenuitem.c
Log:
add glade support for libxfcegui4 - adds an optional dependency on
libgladeui (but libxfcegui4 is not linked to it; just needed to build a
helper library that glade uses), and installs a glade catalog file and some
pixmaps to glade's data directory.
also fixed up XfceAppMenuItem to use properties where possible and be more
glade- and bindings-friendly
bump version to 4.5.1
Modified: libxfcegui4/trunk/Makefile.am
===================================================================
--- libxfcegui4/trunk/Makefile.am 2007-08-17 12:07:39 UTC (rev 25987)
+++ libxfcegui4/trunk/Makefile.am 2007-08-18 19:52:49 UTC (rev 25988)
@@ -1,10 +1,15 @@
# $Id$
+if HAVE_GLADEUI
+glade_dir = glade
+endif
+
SUBDIRS = \
icons \
libxfcegui4 \
docs \
- po
+ po
\
+ $(glade_dir)
AUTOMAKE_OPTIONS = \
1.8 \
Modified: libxfcegui4/trunk/configure.in.in
===================================================================
--- libxfcegui4/trunk/configure.in.in 2007-08-17 12:07:39 UTC (rev 25987)
+++ libxfcegui4/trunk/configure.in.in 2007-08-18 19:52:49 UTC (rev 25988)
@@ -10,7 +10,7 @@
m4_define([libxfcegui4_verinfo], [6:4:2])
m4_define([libxfcegui4_version_major], [4])
m4_define([libxfcegui4_version_minor], [5])
-m4_define([libxfcegui4_version_micro], [0])
+m4_define([libxfcegui4_version_micro], [1])
m4_define([libxfcegui4_version_nano], []) dnl leave this empty to have no
nano version
m4_define([libxfcegui4_version_build], [EMAIL PROTECTED]@])
m4_define([libxfcegui4_version_tag], [])
@@ -74,6 +74,7 @@
AC_PROG_CC()
AC_PROG_INSTALL()
AC_PROG_LIBTOOL()
+AC_PROG_INTLTOOL([0.31], [no-xml])
dnl ************************************************
dnl *** Check for standard headers and functions ***
@@ -107,6 +108,22 @@
[0.5], [startup-notification],
[startup notification library])
+XDT_CHECK_OPTIONAL_PACKAGE([GLADEUI], [gladeui-1.0], [3.0.0], [glade],
+ [glade/libglade integration])
+if test "x$GLADEUI_FOUND" = "xyes"; then
+ GLADE_CATALOG_DIR="`$PKG_CONFIG gladeui-1.0 --variable=catalogdirr`"
+ GLADE_PIXMAP_DIR="`$PKG_CONFIG gladeui-1.0 --variable=pixmapdir`"
+ GLADE_MODULE_DIR="`$PKG_CONFIG gladeui-1.0 --variable=moduledir`"
+else
+ GLADE_CATALOG_DIR=
+ GLADE_PIXMAP_DIR=
+ GLADE_MODULE_DIR=
+fi
+AC_SUBST(GLADE_CATALOG_DIR)
+AC_SUBST(GLADE_PIXMAP_DIR)
+AC_SUBST(GLADE_MODULE_DIR)
+AM_CONDITIONAL([HAVE_GLADEUI], [test "x$GLADEUI_FOUND" = "xyes"])
+
dnl *************************
dnl *** Check for gtk-doc ***
dnl *************************
@@ -220,6 +237,9 @@
Makefile
docs/version.xml
docs/Makefile
+glade/Makefile
+glade/16x16/Makefile
+glade/22x22/Makefile
icons/Makefile
icons/48x48/Makefile
icons/scalable/Makefile
Added: libxfcegui4/trunk/glade/16x16/Makefile.am
===================================================================
--- libxfcegui4/trunk/glade/16x16/Makefile.am (rev 0)
+++ libxfcegui4/trunk/glade/16x16/Makefile.am 2007-08-18 19:52:49 UTC (rev
25988)
@@ -0,0 +1,9 @@
+gladepixmapdir = $(GLADE_PIXMAP_DIR)/16x16
+gladepixmap_DATA = \
+ xfce-app-menu-item.png \
+ xfce-heading.png \
+ xfce-movehandler.png \
+ xfce-scaled-image.png \
+ xfce-titled-dialog.png
+
+EXTRA_DIST = $(gladepixmap_DATA)
Added: libxfcegui4/trunk/glade/16x16/xfce-app-menu-item.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/16x16/xfce-app-menu-item.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/16x16/xfce-heading.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/16x16/xfce-heading.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/16x16/xfce-movehandler.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/16x16/xfce-movehandler.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/16x16/xfce-scaled-image.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/16x16/xfce-scaled-image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/16x16/xfce-titled-dialog.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/16x16/xfce-titled-dialog.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/22x22/Makefile.am
===================================================================
--- libxfcegui4/trunk/glade/22x22/Makefile.am (rev 0)
+++ libxfcegui4/trunk/glade/22x22/Makefile.am 2007-08-18 19:52:49 UTC (rev
25988)
@@ -0,0 +1,9 @@
+gladepixmapdir = $(GLADE_PIXMAP_DIR)/22x22
+gladepixmap_DATA = \
+ xfce-app-menu-item.png \
+ xfce-heading.png \
+ xfce-movehandler.png \
+ xfce-scaled-image.png \
+ xfce-titled-dialog.png
+
+EXTRA_DIST = $(gladepixmap_DATA)
Added: libxfcegui4/trunk/glade/22x22/xfce-app-menu-item.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/22x22/xfce-app-menu-item.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/22x22/xfce-heading.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/22x22/xfce-heading.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/22x22/xfce-movehandler.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/22x22/xfce-movehandler.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/22x22/xfce-scaled-image.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/22x22/xfce-scaled-image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/22x22/xfce-titled-dialog.png
===================================================================
(Binary files differ)
Property changes on: libxfcegui4/trunk/glade/22x22/xfce-titled-dialog.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: libxfcegui4/trunk/glade/Makefile.am
===================================================================
--- libxfcegui4/trunk/glade/Makefile.am (rev 0)
+++ libxfcegui4/trunk/glade/Makefile.am 2007-08-18 19:52:49 UTC (rev 25988)
@@ -0,0 +1,41 @@
+SUBDIRS = \
+ 16x16 \
+ 22x22
+
+INCLUDES = \
+ $(PLATFORM_CPPFLAGS)
+
+glademoduledir = $(GLADE_MODULE_DIR)
+
+glademodule_LTLIBRARIES = libgladexfce4.la
+
+libgladexfce4_la_SOURCES = \
+ glade-xfce4.c
+
+libgladexfce4_la_CFLAGS = \
+ -I$(top_srcdir) \
+ $(GLADEUI_CFLAGS) \
+ $(PLATFORM_CFLAGS)
+
+libgladexfce4_la_LDFLAGS = \
+ -avoid-version \
+ -module
+if HAVE_CYGWIN
+ libgladexfce4_la_LDFLAGS += \
+ -no-undefined
+endif
+libgladexfce4_la_LDFLAGS += \
+ $(PLATFORM_LDFLAGS)
+
+libgladexfce4_la_LIBADD = \
+ $(GLADEUI_LIBS) \
+ $(top_builddir)/libxfcegui4/libxfcegui4.la
+
+
+gladecatalogdir = $(GLADE_CATALOG_DIR)
+gladecatalog_DATA = xfce4.xml xfce4.xml.in
[EMAIL PROTECTED]@
+
+
+CLEANFILES = xfce4.xml
+EXTRA_DIST = $(gladecatalog_DATA)
Added: libxfcegui4/trunk/glade/glade-xfce4.c
===================================================================
--- libxfcegui4/trunk/glade/glade-xfce4.c (rev 0)
+++ libxfcegui4/trunk/glade/glade-xfce4.c 2007-08-18 19:52:49 UTC (rev
25988)
@@ -0,0 +1,107 @@
+/*
+ * gladexfce4 - glade module for libxfcegui4
+ *
+ * Copyright (c) 2007 Brian Tarricone <[EMAIL PROTECTED]>
+ *
+ * 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; version 2 of the License ONLY.
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+ */
+
+/* Portions based on glade-gtk.c, which is Copyright (c) 2001 Ximian, Inc.,
+ and is released under the GNU GPL as well. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <gladeui/glade.h>
+
+void
+glade_xfce_titled_dialog_post_create(GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ GladeCreateReason reason)
+{
+ GtkDialog *dialog = GTK_DIALOG(object);
+ GladeWidget *widget, *vbox_widget, *actionarea_widget;
+
+ g_return_if_fail(GTK_IS_DIALOG(dialog));
+
+ widget = glade_widget_get_from_gobject(GTK_WIDGET(dialog));
+ if(!widget)
+ return;
+
+ if(reason == GLADE_CREATE_USER) {
+ /* HIG compliant border-width defaults on dialogs */
+ glade_widget_property_set(widget, "border-width", 5);
+ }
+
+ vbox_widget = glade_widget_adaptor_create_internal(widget,
+ G_OBJECT(dialog->vbox),
+ "vbox", "dialog",
+ FALSE, reason);
+
+ actionarea_widget = glade_widget_adaptor_create_internal(vbox_widget,
+
G_OBJECT(dialog->action_area),
+ "action_area",
+ "dialog", FALSE,
+ reason);
+
+ /* These properties are controlled by the GtkDialog style properties:
+ * "content-area-border", "button-spacing" and "action-area-border",
+ * so we must disable thier use.
+ */
+ glade_widget_remove_property(vbox_widget, "border-width");
+ glade_widget_remove_property(actionarea_widget, "border-width");
+ glade_widget_remove_property(actionarea_widget, "spacing");
+
+ /* Only set these on the original create. */
+ if(reason == GLADE_CREATE_USER) {
+ /* HIG compliant spacing defaults on dialogs */
+ glade_widget_property_set(vbox_widget, "spacing", 2);
+ glade_widget_property_set(vbox_widget, "size", 2);
+ glade_widget_property_set(actionarea_widget, "size", 2);
+ glade_widget_property_set(actionarea_widget, "layout-style",
+ GTK_BUTTONBOX_END);
+ }
+}
+
+GtkWidget *
+glade_xfce_titled_dialog_get_internal_child(GladeWidgetAdaptor *adaptor,
+ GtkDialog *dialog,
+ const gchar *name)
+{
+ GtkWidget *child = NULL;
+
+ g_return_val_if_fail(GTK_IS_DIALOG(dialog), NULL);
+
+ if(!strcmp("vbox", name))
+ child = dialog->vbox;
+ else if(!strcmp("action_area", name))
+ child = dialog->action_area;
+
+ return child;
+}
+
+GList *
+glade_xfce_titled_dialog_get_children(GladeWidgetAdaptor *adaptor,
+ GtkDialog *dialog)
+{
+ g_return_val_if_fail(GTK_IS_DIALOG(dialog), NULL);
+ return g_list_prepend(NULL, dialog->vbox);
+}
Added: libxfcegui4/trunk/glade/xfce4.xml.in
===================================================================
--- libxfcegui4/trunk/glade/xfce4.xml.in (rev 0)
+++ libxfcegui4/trunk/glade/xfce4.xml.in 2007-08-18 19:52:49 UTC (rev
25988)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<glade-catalog name="xfce4" library="gladexfce4" domain="glade3" book="xfce4">
+ <glade-widget-classes>
+
+ <!-- TODO: this needs some special setup in the glade helper lib to
+ create and populate the XfceAboutInfo struct.
+ <glade-widget-class name="XfceAboutDialog" _title="Xfce About Dialog"
+ generic-name="xfce-about-dialog">
+
+ </glade-widget-class>
+ -->
+
+ <glade-widget-class name="XfceAppMenuItem" _title="Launcher Menu Item"
+ generic-name="xfce-app-menu-item">
+ <properties>
+ <property id="label" _name="Label"/>
+ <property id="command" _name="Command"/>
+ <property id="icon-name" _name="Icon Filename"/>
+ <property id="needs-term" _name="Needs Terminal"/>
+ <property id="snotify" _name="Supports Startup Notification"/>
+ </properties>
+ </glade-widget-class>
+
+ <glade-widget-class name="XfceHeading" _title="Dialog Header"
+ generic-name="xfce-heading">
+ <properties>
+ <property id="icon" _name="Icon"/>
+ <property id="icon-name" _name="Icon Name"/>
+ <property id="title" _name="Title"/>
+ <property id="subtitle" _name="Subtitle"/>
+ </properties>
+ </glade-widget-class>
+
+ <glade-widget-class name="XfceMovehandler" _title="Move Handle"
+ generic-name="xfce-movehandler">
+ <!-- TODO: need a way to set the XfceMoveFunc -->
+ </glade-widget-class>
+
+ <glade-widget-class name="XfceScaledImage" _title="Scaled Image"
+ generic-name="xfce-scaled-image">
+ <!-- TODO: need properties or something to set the image -->
+ </glade-widget-class>
+
+ <glade-widget-class name="XfceTitledDialog" _title="Titled Dialog"
+ generic-name="xfce-titled-dialog">
+
<post-create-function>glade_xfce_titled_dialog_post_create</post-create-function>
+
<get-internal-child-function>glade_xfce_titled_dialog_get_internal_child</get-internal-child-function>
+
<get-children-function>glade_xfce_titled_dialog_get_children</get-children-function>
+
+ <properties>
+ <property id="subtitle" _name="Subtitle"/>
+ </properties>
+ </glade-widget-class>
+ </glade-widget-classes>
+
+ <glade-widget-group name="xfce4-widgets" _title="Xfce4 Widgets">
+ <glade-widget-class-ref name="XfceAppMenuItem"/>
+ <glade-widget-class-ref name="XfceHeading"/>
+ <glade-widget-class-ref name="XfceMovehandler"/>
+ <glade-widget-class-ref name="XfceScaledImage"/>
+ <glade-widget-class-ref name="XfceTitledDialog"/>
+ </glade-widget-group>
+
+</glade-catalog>
Modified: libxfcegui4/trunk/libxfcegui4/xfce-appmenuitem.c
===================================================================
--- libxfcegui4/trunk/libxfcegui4/xfce-appmenuitem.c 2007-08-17 12:07:39 UTC
(rev 25987)
+++ libxfcegui4/trunk/libxfcegui4/xfce-appmenuitem.c 2007-08-18 19:52:49 UTC
(rev 25988)
@@ -48,6 +48,8 @@
gchar *command_expanded;
gchar *dot_desktop_filename;
+
+ GtkWidget *accel_label;
};
enum {
@@ -55,6 +57,9 @@
PROP_TERM,
PROP_CMD,
PROP_ICON,
+ PROP_LABEL,
+ PROP_SNOTIFY,
+ PROP_USE_UNDERLINE,
};
static void xfce_app_menu_item_class_init(XfceAppMenuItemClass *klass);
@@ -235,11 +240,33 @@
g_param_spec_string("icon_name", _("Icon name"),
_("The name of the themed icon to display next to the
item"),
NULL, G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_LABEL,
+ g_param_spec_string("label", _("Label"),
+ _("The label displayed in the item"),
+ NULL, G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_SNOTIFY,
+ g_param_spec_boolean("snotify", _("Startup notification"),
+ _("Whether or not the app supports startup
notification"),
+ FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property(gobject_class, PROP_USE_UNDERLINE,
+ g_param_spec_boolean("use-underline", _("Use underline"),
+ _("Whether or not to use an underscore in the
label as a keyboard mnemonic"),
+ FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ if(-1 == _xfce_app_menu_item_icon_size) {
+ gtk_icon_size_lookup(GTK_ICON_SIZE_MENU,
+ &_xfce_app_menu_item_icon_size, NULL);
+ }
}
static void
xfce_app_menu_item_init(XfceAppMenuItem *app_menu_item)
{
+ GtkWidget *accel_label;
+
app_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE(app_menu_item,
XFCE_TYPE_APP_MENU_ITEM,
XfceAppMenuItemPriv);
@@ -248,10 +275,18 @@
GDK_STRUCTURE_MASK | GDK_SUBSTRUCTURE_MASK
| GDK_VISIBILITY_NOTIFY_MASK);
- if(-1 == _xfce_app_menu_item_icon_size) {
- gtk_icon_size_lookup(GTK_ICON_SIZE_MENU,
- &_xfce_app_menu_item_icon_size, NULL);
- }
+ g_signal_connect(G_OBJECT(app_menu_item), "activate",
+ G_CALLBACK(_command_activate_cb), NULL);
+ g_signal_connect(G_OBJECT(app_menu_item), "style-set",
+ G_CALLBACK(_style_set_cb), NULL);
+
+ app_menu_item->priv->accel_label = accel_label = gtk_accel_label_new("");
+ gtk_misc_set_alignment(GTK_MISC(accel_label), 0.0, 0.5);
+
+ gtk_container_add(GTK_CONTAINER(app_menu_item), accel_label);
+ gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(accel_label),
+ GTK_WIDGET(app_menu_item));
+ gtk_widget_show(accel_label);
}
static void
@@ -262,23 +297,29 @@
switch(prop_id) {
case PROP_TERM:
- {
- gboolean nterm = g_value_get_boolean(value);
- xfce_app_menu_item_set_needs_term(app_menu_item, nterm);
- }
+ xfce_app_menu_item_set_needs_term(app_menu_item,
+ g_value_get_boolean(value));
break;
case PROP_CMD:
- {
- const gchar *cmd = g_value_get_string(value);
- xfce_app_menu_item_set_command(app_menu_item, (gchar *)cmd);
- }
+ xfce_app_menu_item_set_command(app_menu_item,
+ g_value_get_string(value));
break;
case PROP_ICON:
- {
- const gchar *icon = g_value_get_string(value);
- xfce_app_menu_item_set_icon_name(app_menu_item, (gchar *)icon);
- }
+ xfce_app_menu_item_set_icon_name(app_menu_item,
+ g_value_get_string(value));
break;
+ case PROP_LABEL:
+ xfce_app_menu_item_set_name(app_menu_item,
+ g_value_get_string(value));
+ break;
+ case PROP_SNOTIFY:
+ xfce_app_menu_item_set_startup_notification(app_menu_item,
+
g_value_get_boolean(value));
+ break;
+ case PROP_USE_UNDERLINE:
+
gtk_label_set_use_underline(GTK_LABEL(app_menu_item->priv->accel_label),
+ g_value_get_boolean(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -301,6 +342,16 @@
case PROP_ICON:
g_value_set_string(value, app_menu_item->priv->icon_name);
break;
+ case PROP_LABEL:
+ g_value_set_string(value, app_menu_item->priv->name);
+ break;
+ case PROP_SNOTIFY:
+ g_value_set_boolean(value, app_menu_item->priv->snotify);
+ break;
+ case PROP_USE_UNDERLINE:
+ g_value_set_boolean(value,
+
gtk_label_get_use_underline(GTK_LABEL(app_menu_item->priv->accel_label)));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -372,14 +423,7 @@
GtkWidget *
xfce_app_menu_item_new()
{
- XfceAppMenuItem *app_menu_item = g_object_new(XFCE_TYPE_APP_MENU_ITEM,
NULL);
-
- g_signal_connect(G_OBJECT(app_menu_item), "activate",
- G_CALLBACK(_command_activate_cb), NULL);
- g_signal_connect(G_OBJECT(app_menu_item), "style-set",
- G_CALLBACK(_style_set_cb), NULL);
-
- return GTK_WIDGET(app_menu_item);
+ return g_object_new(XFCE_TYPE_APP_MENU_ITEM, NULL);
}
/**
@@ -394,22 +438,9 @@
GtkWidget *
xfce_app_menu_item_new_with_label(const gchar *label)
{
- XfceAppMenuItem *app_menu_item;
- GtkWidget *accel_label;
-
- app_menu_item = XFCE_APP_MENU_ITEM(xfce_app_menu_item_new());
-
- app_menu_item->priv->name = g_strdup(label);
-
- accel_label = gtk_accel_label_new(app_menu_item->priv->name);
- gtk_misc_set_alignment(GTK_MISC(accel_label), 0.0, 0.5);
-
- gtk_container_add(GTK_CONTAINER(app_menu_item), accel_label);
- gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(accel_label),
- GTK_WIDGET(app_menu_item));
- gtk_widget_show(accel_label);
-
- return GTK_WIDGET(app_menu_item);
+ return g_object_new(XFCE_TYPE_APP_MENU_ITEM,
+ "label", label,
+ NULL);
}
/**
@@ -427,24 +458,10 @@
GtkWidget *
xfce_app_menu_item_new_with_mnemonic(const gchar *label)
{
- XfceAppMenuItem *app_menu_item;
- GtkWidget *accel_label;
-
- app_menu_item = XFCE_APP_MENU_ITEM(xfce_app_menu_item_new());
-
- app_menu_item->priv->name = g_strdup(label);
-
- accel_label = g_object_new(GTK_TYPE_ACCEL_LABEL, NULL);
- gtk_label_set_text_with_mnemonic(GTK_LABEL(accel_label),
- app_menu_item->priv->name);
- gtk_misc_set_alignment(GTK_MISC(accel_label), 0.0, 0.5);
-
- gtk_container_add(GTK_CONTAINER(app_menu_item), accel_label);
- gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(accel_label),
- GTK_WIDGET(app_menu_item));
- gtk_widget_show(accel_label);
-
- return GTK_WIDGET(app_menu_item);
+ return g_object_new(XFCE_TYPE_APP_MENU_ITEM,
+ "label", label,
+ "use-underline", TRUE,
+ NULL);
}
/**
@@ -461,24 +478,10 @@
GtkWidget *
xfce_app_menu_item_new_with_command(const gchar *label, const gchar *command)
{
- XfceAppMenuItem *app_menu_item;
- GtkWidget *accel_label;
-
- app_menu_item = XFCE_APP_MENU_ITEM(xfce_app_menu_item_new());
-
- app_menu_item->priv->name = g_strdup(label);
-
- accel_label = gtk_accel_label_new(app_menu_item->priv->name);
- gtk_misc_set_alignment(GTK_MISC(accel_label), 0.0, 0.5);
-
- gtk_container_add(GTK_CONTAINER(app_menu_item), accel_label);
- gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(accel_label),
- GTK_WIDGET(app_menu_item));
- gtk_widget_show(accel_label);
-
- app_menu_item->priv->command = xfce_expand_variables(command, NULL);
-
- return GTK_WIDGET(app_menu_item);
+ return g_object_new(XFCE_TYPE_APP_MENU_ITEM,
+ "label", label,
+ "command", command,
+ NULL);
}
/**
@@ -500,23 +503,13 @@
GtkWidget *xfce_app_menu_item_new_full(const gchar *label, const gchar
*command,
const gchar *icon_filename, gboolean needs_term, gboolean snotify)
{
- XfceAppMenuItem *app_menu_item = NULL;
-
- if(!label)
- app_menu_item = XFCE_APP_MENU_ITEM(xfce_app_menu_item_new());
- else {
- app_menu_item =
XFCE_APP_MENU_ITEM(xfce_app_menu_item_new_with_label(label));
- if(command)
- xfce_app_menu_item_set_command(app_menu_item, command);
- if(icon_filename)
- xfce_app_menu_item_set_icon_name(app_menu_item, icon_filename);
- if(needs_term)
- xfce_app_menu_item_set_needs_term(app_menu_item, needs_term);
- if(snotify)
- xfce_app_menu_item_set_startup_notification(app_menu_item,
snotify);
- }
-
- return GTK_WIDGET(app_menu_item);
+ return g_object_new(XFCE_TYPE_APP_MENU_ITEM,
+ "label", label,
+ "command", command,
+ "icon-name", icon_filename,
+ "needs-term", needs_term,
+ "snotify", snotify,
+ NULL);
}
/**
@@ -545,8 +538,6 @@
g_return_val_if_fail(XFCE_IS_DESKTOP_ENTRY(entry), NULL);
- app_menu_item = XFCE_APP_MENU_ITEM(xfce_app_menu_item_new());
-
if(xfce_desktop_entry_get_string(entry, "OnlyShowIn", FALSE, &onlyshowin)
|| xfce_desktop_entry_get_string(entry, "Categories", FALSE,
&categories))
@@ -566,7 +557,6 @@
} else if(onlyshowin) {
g_free(onlyshowin);
g_free(categories);
- gtk_widget_destroy(GTK_WIDGET(app_menu_item));
return NULL;
}
@@ -574,6 +564,8 @@
g_free(categories);
}
+ app_menu_item = XFCE_APP_MENU_ITEM(xfce_app_menu_item_new());
+
if(!name && !xfce_desktop_entry_get_string(entry, "Name", TRUE, &name)) {
gchar *tmp, *tmp1;
@@ -601,12 +593,8 @@
return NULL;
}
- accel_label = gtk_accel_label_new(app_menu_item->priv->name);
- gtk_misc_set_alignment(GTK_MISC(accel_label), 0.0, 0.5);
- gtk_container_add(GTK_CONTAINER(app_menu_item), accel_label);
- gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(accel_label),
- GTK_WIDGET(app_menu_item));
- gtk_widget_show(accel_label);
+ gtk_label_set_text(GTK_LABEL(app_menu_item->priv->accel_label),
+ app_menu_item->priv->name);
if(xfce_desktop_entry_get_string(entry, "Terminal", TRUE, &term)) {
app_menu_item->priv->needs_term = (*term == '1'
@@ -677,6 +665,7 @@
g_free(app_menu_item->priv->name);
app_menu_item->priv->name = g_strdup(name);
+ gtk_label_set_text(GTK_LABEL(app_menu_item->priv->accel_label), name);
}
/**
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits