[Xfce4-commits] <terminal:master> Depend on libxfce4ui and use its API.
Nick Schermer
noreply at xfce.org
Sat Jan 7 18:58:01 CET 2012
Updating branch refs/heads/master
to 684a935907f6aeb3e0eb29d5821c83c367c4e045 (commit)
from 10374f480290e3f6bab65e70d6ddff73849ce9f6 (commit)
commit 684a935907f6aeb3e0eb29d5821c83c367c4e045
Author: Nick Schermer <nick at xfce.org>
Date: Sat Jan 7 18:55:31 2012 +0100
Depend on libxfce4ui and use its API.
Use the help function and drop some other API that
is part of the library.
configure.ac.in | 4 +-
terminal/Makefile.am | 39 +-
terminal/main.c | 2 +-
terminal/terminal-dialogs.c | 209 +---------
terminal/terminal-dialogs.h | 9 -
terminal/terminal-preferences-dialog.c | 6 +-
terminal/terminal-screen.c | 8 +-
terminal/terminal-widget.c | 4 +-
terminal/terminal-window.c | 8 +-
terminal/xfce-heading.c | 738 --------------------------------
terminal/xfce-heading.h | 66 ---
terminal/xfce-titled-dialog.c | 271 ------------
terminal/xfce-titled-dialog.h | 63 ---
13 files changed, 39 insertions(+), 1388 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 918ca86..6ad89a3 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -81,11 +81,11 @@ XDT_CHECK_LIBX11()
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
-XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.4], [],
- [XDT_CHECK_PACKAGE([EXO], [exo-1], [0.5.0])])
+XDT_CHECK_PACKAGE([EXO], [exo-1], [0.5.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
XDT_CHECK_PACKAGE([VTE], [vte], [0.17.1])
XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.16.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.9.0])
dnl **********************************
dnl *** Optional support for D-BUS ***
diff --git a/terminal/Makefile.am b/terminal/Makefile.am
index f84a7e3..d4a8c2c 100644
--- a/terminal/Makefile.am
+++ b/terminal/Makefile.am
@@ -39,16 +39,9 @@ Terminal_headers = \
terminal-window.h \
terminal-window-ui.h
-Terminal_tmp_sources = \
- xfce-heading.c \
- xfce-heading.h \
- xfce-titled-dialog.c \
- xfce-titled-dialog.h
-
Terminal_SOURCES = \
$(Terminal_built_sources) \
$(Terminal_headers) \
- $(Terminal_tmp_sources) \
main.c \
terminal-accel-map.c \
terminal-app.c \
@@ -72,6 +65,7 @@ Terminal_CFLAGS = \
$(GIO_CFLAGS) \
$(LIBX11_CFLAGS)\
$(VTE_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
$(PLATFORM_CFLAGS)
Terminal_LDFLAGS = \
@@ -86,6 +80,7 @@ Terminal_LDADD = \
$(LIBX11_LDFLAGS) \
$(LIBX11_LIBS) \
$(VTE_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
$(TERMINAL_LIBS)
# install symlink to 'terminal'
@@ -135,22 +130,22 @@ terminal-enum-types.h: stamp-terminal-enum-types.h
@true
stamp-terminal-enum-types.h: terminal-preferences.h Makefile
$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
---fhead "#ifndef __TERMINAL_ENUM_TYPES_H__\n#define __TERMINAL_ENUM_TYPES_H__\n#include <exo/exo.h>\nG_BEGIN_DECLS\n" \
---fprod "/* enumerations from \"@filename@\" */\n" \
---vhead "GType @enum_name at _get_type (void);\n#define TERMINAL_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
---ftail "G_END_DECLS\n\n#endif /* !__TERMINAL_ENUM_TYPES_H__ */" \
-terminal-preferences.h ) >> xgen-teth \
+ --fhead "#ifndef __TERMINAL_ENUM_TYPES_H__\n#define __TERMINAL_ENUM_TYPES_H__\n#include <exo/exo.h>\nG_BEGIN_DECLS\n" \
+ --fprod "/* enumerations from \"@filename@\" */\n" \
+ --vhead "GType @enum_name at _get_type (void);\n#define TERMINAL_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
+ --ftail "G_END_DECLS\n\n#endif /* !__TERMINAL_ENUM_TYPES_H__ */" \
+ terminal-preferences.h ) >> xgen-teth \
&& (cmp -s xgen-teth terminal-enum-types.h || cp xgen-teth terminal-enum-types.h ) \
&& rm -f xgen-teth \
&& echo timestamp > $(@F)
terminal-enum-types.c: terminal-preferences.h Makefile
$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
---fhead "#ifdef HAVE_CONFIG_H\n#include <config.h>\n#endif\n#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <terminal/terminal-enum-types.h>\n#include <terminal/terminal-app.h>\n#include <terminal/terminal-preferences.h>" \
---fprod " \n/* enumerations from \"@filename@\" */" \
---vhead "GType\n at enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G at Type@Value values[] = {" \
---vprod " \t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
---vtail " \t{ 0, NULL, NULL }\n\t};\n\ttype = g_ at type@_register_static (\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
-terminal-preferences.h ) >> xgen-tetc \
+ --fhead "#ifdef HAVE_CONFIG_H\n#include <config.h>\n#endif\n#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <terminal/terminal-enum-types.h>\n#include <terminal/terminal-app.h>\n#include <terminal/terminal-preferences.h>" \
+ --fprod " \n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n at enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G at Type@Value values[] = {" \
+ --vprod " \t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " \t{ 0, NULL, NULL }\n\t};\n\ttype = g_ at type@_register_static (\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
+ terminal-preferences.h ) >> xgen-tetc \
&& cp xgen-tetc terminal-enum-types.c \
&& rm -f xgen-tetc
@@ -158,8 +153,8 @@ terminal-marshal.h: stamp-terminal-marshal.h
@true
stamp-terminal-marshal.h: terminal-marshal.list Makefile
$(AM_V_GEN) ( cd $(srcdir) && glib-genmarshal \
---prefix=_terminal_marshal \
---header terminal-marshal.list ) >> xgen-tmh \
+ --prefix=_terminal_marshal \
+ --header terminal-marshal.list ) >> xgen-tmh \
&& ( cmp -s xgen-tmh terminal-marshal.h || cp xgen-tmh terminal-marshal.h ) \
&& rm -f xgen-tmh \
&& echo timestamp > $(@F)
@@ -167,8 +162,8 @@ stamp-terminal-marshal.h: terminal-marshal.list Makefile
terminal-marshal.c: terminal-marshal.list Makefile
$(AM_V_GEN) echo "#include <terminal/terminal-marshal.h>" > xgen-tmc \
&& ( cd $(srcdir) && glib-genmarshal \
---prefix=_terminal_marshal \
---body terminal-marshal.list ) >> xgen-tmc \
+ --prefix=_terminal_marshal \
+ --body terminal-marshal.list ) >> xgen-tmc \
&& cp xgen-tmc terminal-marshal.c \
&& rm -f xgen-tmc
endif
diff --git a/terminal/main.c b/terminal/main.c
index 66567e2..75124d9 100644
--- a/terminal/main.c
+++ b/terminal/main.c
@@ -143,7 +143,7 @@ main (int argc, char **argv)
name = g_get_prgname ();
g_print ("%s %s (Xfce %s)\n\n", name, PACKAGE_VERSION, xfce_version_string ());
g_free (name);
- g_print ("%s\n", "Copyright (c) 2003-2011");
+ g_print ("%s\n", "Copyright (c) 2003-2012");
g_print ("\t%s\n\n", _("The Xfce development team. All rights reserved."));
g_print ("%s\n", _("Written by Benedikt Meurer <benny at xfce.org>"));
g_print ("%s\n\n", _("and Nick Schermer <nick at xfce.org>."));
diff --git a/terminal/terminal-dialogs.c b/terminal/terminal-dialogs.c
index b5afdbb..0456e19 100644
--- a/terminal/terminal-dialogs.c
+++ b/terminal/terminal-dialogs.c
@@ -79,13 +79,8 @@ terminal_dialogs_show_about (GtkWindow *parent)
/* set dialog hook on gtk versions older then 2.18 */
#if !GTK_CHECK_VERSION (2, 18, 0)
-#if EXO_CHECK_VERSION (0, 5, 0)
gtk_about_dialog_set_email_hook (exo_gtk_url_about_dialog_hook, NULL, NULL);
gtk_about_dialog_set_url_hook (exo_gtk_url_about_dialog_hook, NULL, NULL);
-#else
- gtk_about_dialog_set_email_hook (exo_url_about_dialog_hook, NULL, NULL);
- gtk_about_dialog_set_url_hook (exo_url_about_dialog_hook, NULL, NULL);
-#endif
#endif
/* open the about dialog */
@@ -95,7 +90,7 @@ terminal_dialogs_show_about (GtkWindow *parent)
"comments", _("Xfce Terminal Emulator"),
"documenters", documenters,
"copyright", "Copyright \302\251 2003-2008 Benedikt Meurer\n"
- "Copyright \302\251 2007-2011 Nick Schermer",
+ "Copyright \302\251 2007-2012 Nick Schermer",
"license", XFCE_LICENSE_GPL,
"logo", logo,
"program-name", g_get_application_name (),
@@ -109,205 +104,3 @@ terminal_dialogs_show_about (GtkWindow *parent)
if (G_LIKELY (logo != NULL))
g_object_unref (G_OBJECT (logo));
}
-
-
-
-/**
- * terminal_dialogs_show_error:
- * @parent : a #GtkWidget on which the error dialog should be shown, or a #GdkScreen
- * if no #GtkWidget is known. May also be %NULL, in which case the default
- * #GdkScreen will be used.
- * @error : a #GError, which gives a more precise description of the problem or %NULL.
- * @format : the printf()-style format for the primary problem description.
- * @... : argument list for the @format.
- *
- * Displays an error dialog on @widget using the @format as primary message and optionally
- * displaying @error as secondary error text.
- *
- * If @widget is not %NULL and @widget is part of a #GtkWindow, the function makes sure
- * that the toplevel window is visible prior to displaying the error dialog.
- **/
-void
-terminal_dialogs_show_error (gpointer parent,
- const GError *error,
- const gchar *format,
- ...)
-{
- GtkWidget *dialog;
- GtkWidget *window = NULL;
- GdkScreen *screen;
- va_list args;
- gchar *primary_text;
-
- terminal_return_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent));
-
- /* determine the proper parent */
- if (parent == NULL)
- {
- /* just use the default screen then */
- screen = gdk_screen_get_default ();
- }
- else if (GDK_IS_SCREEN (parent))
- {
- /* yep, that's a screen */
- screen = GDK_SCREEN (parent);
- }
- else
- {
- /* parent is a widget, so let's determine the toplevel window */
- window = gtk_widget_get_toplevel (GTK_WIDGET (parent));
- if (GTK_WIDGET_TOPLEVEL (window))
- {
- /* make sure the toplevel window is shown */
- gtk_widget_show_now (window);
- }
- else
- {
- /* no toplevel, not usable then */
- window = NULL;
- }
-
- /* determine the screen for the widget */
- screen = gtk_widget_get_screen (GTK_WIDGET (parent));
- }
-
- /* determine the primary error text */
- va_start (args, format);
- primary_text = g_strdup_vprintf (format, args);
- va_end (args);
-
- /* allocate the error dialog */
- dialog = gtk_message_dialog_new ((GtkWindow *) window,
- GTK_DIALOG_DESTROY_WITH_PARENT
- | GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "%s.", primary_text);
-
- /* move the dialog to the appropriate screen */
- if (window == NULL && screen != NULL)
- gtk_window_set_screen (GTK_WINDOW (dialog), screen);
-
- /* set secondary text if an error is provided */
- if (G_LIKELY (error != NULL))
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s.", error->message);
-
- /* display the dialog */
- gtk_dialog_run (GTK_DIALOG (dialog));
-
- /* cleanup */
- gtk_widget_destroy (dialog);
- g_free (primary_text);
-}
-
-
-
-static gboolean
-terminal_dialogs_show_help_ask_online (GtkWindow *parent)
-{
- GtkWidget *dialog;
- GtkWidget *button;
- GtkWidget *image;
- gint response_id;
-
- dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,
- _("The %s user manual is not installed on your computer"),
- g_get_application_name ());
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("You can read the user manual online. This manual may however "
- "not exactly match your %s version."), g_get_application_name ());
- gtk_window_set_title (GTK_WINDOW (dialog), _("User manual is missing"));
-
- button = gtk_button_new_with_mnemonic (_("_Read Online"));
- gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_ACCEPT);
- gtk_widget_show (button);
-
- image = gtk_image_new_from_icon_name ("web-browser", GTK_ICON_SIZE_BUTTON);
- gtk_button_set_image (GTK_BUTTON (button), image);
- gtk_widget_show (image);
-
- response_id = gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return (response_id == GTK_RESPONSE_ACCEPT);
-}
-
-
-
-/**
- * terminal_dialogs_show_help:
- * @parent : a #GtkWindow.
- * #GdkScreen will be used.
- * @page : the name of the page of the user manual to display or %NULL to display
- * the overview page.
- * @offset : the offset of the topic in the @page to display or %NULL to just display
- * @page.
- *
- * Displays the Terminal user manual. If @page is not %NULL it specifies the basename
- * of the HTML file to display. @offset may refer to a anchor in the @page.
- **/
-void
-terminal_dialogs_show_help (GtkWindow *parent,
- const gchar *page,
- const gchar *offset)
-{
- GError *error = NULL;
- gchar *filename;
- gchar *locale;
- gboolean exists;
- gchar *uri = NULL;
-
- terminal_return_if_fail (GTK_IS_WINDOW (parent));
-
- /* use index page */
- if (page == NULL)
- page = "index.html";
-
- /* get the locale of the user */
- locale = g_strdup (setlocale (LC_MESSAGES, NULL));
- if (G_LIKELY (locale != NULL))
- locale = g_strdelimit (locale, "._", '\0');
- else
- locale = g_strdup ("C");
-
- /* check if the help page exists on the system */
- filename = g_build_filename (HELPDIR, locale, page, NULL);
- exists = g_file_test (filename, G_FILE_TEST_EXISTS);
- if (!exists && strcmp (locale, "C") != 0)
- {
- g_free (filename);
- filename = g_build_filename (HELPDIR, "C", page, NULL);
- exists = g_file_test (filename, G_FILE_TEST_EXISTS);
- }
-
- /* build the full uri, fallback to online docs if nothing was found */
- if (G_LIKELY (exists))
- {
- uri = g_strconcat ("file://", filename, "#", offset, NULL);
- }
- else if (terminal_dialogs_show_help_ask_online (parent))
- {
- uri = g_strconcat ("http://docs.xfce.org/help.php?package=terminal&lang=",
- locale, "&page=", page, "&anchor=", offset, NULL);
- }
-
- g_free (filename);
- g_free (locale);
-
- /* try to run the documentation browser */
- if (uri != NULL
- && !exo_execute_preferred_application_on_screen ("WebBrowser", uri, NULL,
- NULL, gtk_window_get_screen (parent),
- &error))
- {
- /* display an error message to the user */
- terminal_dialogs_show_error (parent, error, _("Failed to open the documentation browser"));
- g_error_free (error);
- }
-
- g_free (uri);
-}
-
-
diff --git a/terminal/terminal-dialogs.h b/terminal/terminal-dialogs.h
index d5afe92..e58f7df 100644
--- a/terminal/terminal-dialogs.h
+++ b/terminal/terminal-dialogs.h
@@ -25,15 +25,6 @@ G_BEGIN_DECLS
void terminal_dialogs_show_about (GtkWindow *parent);
-void terminal_dialogs_show_error (gpointer parent,
- const GError *error,
- const gchar *format,
- ...) G_GNUC_PRINTF (3, 4);
-
-void terminal_dialogs_show_help (GtkWindow *parent,
- const gchar *page,
- const gchar *offset);
-
G_END_DECLS
#endif /* !__TERMINAL_DIALOGS_H__ */
diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index e980222..31a9c0c 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -22,13 +22,14 @@
#include <config.h>
#endif
+#include <libxfce4ui/libxfce4ui.h>
+
#include <terminal/terminal-dialogs.h>
#include <terminal/terminal-enum-types.h>
#include <terminal/terminal-preferences-dialog.h>
#include <terminal/terminal-shortcut-editor.h>
#include <terminal/terminal-stock.h>
#include <terminal/terminal-private.h>
-#include <terminal/xfce-titled-dialog.h>
@@ -266,7 +267,8 @@ terminal_preferences_dialog_response (GtkWidget *widget,
if (G_UNLIKELY (response == 1))
{
/* open the "Preferences" section of the user manual */
- terminal_dialogs_show_help (GTK_WINDOW (widget), "preferences.html", NULL);
+ xfce_dialog_show_help (GTK_WINDOW (widget), "terminal",
+ "preferences", NULL);
}
else
{
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 0c0217a..1a4a8d2 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -39,6 +39,8 @@
#include <time.h>
#endif
+#include <libxfce4ui/libxfce4ui.h>
+
#include <terminal/terminal-dialogs.h>
#include <terminal/terminal-enum-types.h>
#include <terminal/terminal-image-loader.h>
@@ -1379,7 +1381,8 @@ terminal_screen_launch_child (TerminalScreen *screen)
if (!terminal_screen_get_child_command (screen, &command, &argv, &error))
{
/* tell the user that we were unable to execute the command */
- terminal_dialogs_show_error (GTK_WIDGET (screen), error, _("Failed to execute child"));
+ xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (screen))),
+ error, _("Failed to execute child"));
g_error_free (error);
}
else
@@ -1408,7 +1411,8 @@ terminal_screen_launch_child (TerminalScreen *screen)
NULL, NULL,
&screen->pid, &error))
{
- terminal_dialogs_show_error (GTK_WIDGET (screen), error, _("Failed to execute child"));
+ xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (screen))),
+ error, _("Failed to execute child"));
g_error_free (error);
}
diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index 3eed37c..3539ef8 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -30,6 +30,7 @@
#endif
#include <gdk/gdkkeysyms.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <terminal/terminal-dialogs.h>
#include <terminal/terminal-enum-types.h>
@@ -711,7 +712,8 @@ terminal_widget_open_uri (TerminalWidget *widget,
if (!exo_execute_preferred_application_on_screen (category, uri, NULL, NULL, screen, &error))
{
/* tell the user that we were unable to open the responsible application */
- terminal_dialogs_show_error (widget, error, _("Failed to open the URL `%s'"), uri);
+ xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget))),
+ error, _("Failed to open the URL `%s'"), uri);
g_error_free (error);
}
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 0607f5f..c5c9cdb 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -37,6 +37,8 @@
#endif
#include <exo/exo.h>
+#include <libxfce4ui/libxfce4ui.h>
+
#include <gdk/gdkkeysyms.h>
#if defined(GDK_WINDOWING_X11)
#include <gdk/gdkx.h>
@@ -1517,7 +1519,7 @@ title_dialog_response (GtkWidget *dialog,
if (response == GTK_RESPONSE_HELP)
{
/* open the "Set Title" paragraph in the "Usage" section */
- terminal_dialogs_show_help (GTK_WINDOW (dialog), "usage.html", "set-title");
+ xfce_dialog_show_help (GTK_WINDOW (dialog), "terminal", "usage", NULL);
}
else
{
@@ -1620,7 +1622,7 @@ terminal_window_action_report_bug (GtkAction *action,
TerminalWindow *window)
{
/* open the "Support" section of the user manual */
- terminal_dialogs_show_help (GTK_WINDOW (window), "support.html", NULL);
+ xfce_dialog_show_help (GTK_WINDOW (window), "terminal", "support", NULL);
}
@@ -1630,7 +1632,7 @@ terminal_window_action_contents (GtkAction *action,
TerminalWindow *window)
{
/* open the Terminal user manual */
- terminal_dialogs_show_help (GTK_WINDOW (window), NULL, NULL);
+ xfce_dialog_show_help (GTK_WINDOW (window), "terminal", NULL, NULL);
}
diff --git a/terminal/xfce-heading.c b/terminal/xfce-heading.c
deleted file mode 100644
index 5d8057f..0000000
--- a/terminal/xfce-heading.c
+++ /dev/null
@@ -1,738 +0,0 @@
-/*-
- * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <terminal/xfce-heading.h>
-
-
-
-#define XFCE_HEADING_BORDER 6
-#define XFCE_HEADING_SPACING 12
-#define XFCE_HEADING_ICON_SIZE 48
-
-#define XFCE_HEADING_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFCE_TYPE_HEADING, XfceHeadingPrivate))
-
-
-
-/* Property identifiers */
-enum
-{
- PROP_0,
- PROP_ICON,
- PROP_ICON_NAME,
- PROP_SUBTITLE,
- PROP_TITLE,
-};
-
-
-
-static void xfce_heading_finalize (GObject *object);
-static void xfce_heading_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void xfce_heading_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void xfce_heading_realize (GtkWidget *widget);
-static void xfce_heading_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void xfce_heading_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-static gboolean xfce_heading_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-static AtkObject *xfce_heading_get_accessible (GtkWidget *widget);
-static PangoLayout *xfce_heading_make_layout (XfceHeading *heading);
-static GdkPixbuf *xfce_heading_make_pixbuf (XfceHeading *heading);
-static GdkPixbuf *xfce_heading_get_icon (XfceHeading *heading);
-static const gchar *xfce_heading_get_icon_name (XfceHeading *heading);
-static const gchar *xfce_heading_get_subtitle (XfceHeading *heading);
-static const gchar *xfce_heading_get_title (XfceHeading *heading);
-
-
-
-struct _XfceHeadingPrivate
-{
- GdkPixbuf *icon;
- gchar *icon_name;
- gchar *subtitle;
- gchar *title;
-};
-
-
-
-G_DEFINE_TYPE (XfceHeading, xfce_heading, GTK_TYPE_WIDGET)
-
-
-
-static void
-xfce_heading_class_init (XfceHeadingClass *klass)
-{
- GtkWidgetClass *gtkwidget_class;
- GObjectClass *gobject_class;
-
- /* add our private data to the class */
- g_type_class_add_private (klass, sizeof (XfceHeadingPrivate));
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = xfce_heading_finalize;
- gobject_class->get_property = xfce_heading_get_property;
- gobject_class->set_property = xfce_heading_set_property;
-
- gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->realize = xfce_heading_realize;
- gtkwidget_class->size_request = xfce_heading_size_request;
- gtkwidget_class->style_set = xfce_heading_style_set;
- gtkwidget_class->expose_event = xfce_heading_expose_event;
- gtkwidget_class->get_accessible = xfce_heading_get_accessible;
-
- /**
- * XfceHeading:icon:
- *
- * The #GdkPixbuf to display as icon, or %NULL to use the
- * "icon-name" property.
- *
- * Since: 4.4.0
- **/
- g_object_class_install_property (gobject_class,
- PROP_ICON,
- g_param_spec_object ("icon",
- "icon",
- "icon",
- GDK_TYPE_PIXBUF,
- G_PARAM_READWRITE
- | G_PARAM_STATIC_STRINGS));
-
- /**
- * XfceHeading:icon-name:
- *
- * If the "icon" property value is %NULL this is the name of
- * the icon to display instead (looked up using the icon theme).
- * If this property is also %NULL or the specified icon does not
- * exist in the selected icon theme, no icon will be displayed.
- *
- * Since: 4.4.0
- **/
- g_object_class_install_property (gobject_class,
- PROP_ICON_NAME,
- g_param_spec_string ("icon-name",
- "icon-name",
- "icon-name",
- NULL,
- G_PARAM_READWRITE
- | G_PARAM_STATIC_STRINGS));
-
- /**
- * XfceHeading:subtitle:
- *
- * The sub title that should be displayed below the
- * title. May be %NULL or the empty string to display
- * only the title.
- *
- * Since: 4.4.0
- **/
- g_object_class_install_property (gobject_class,
- PROP_SUBTITLE,
- g_param_spec_string ("subtitle",
- "subtitle",
- "subtitle",
- NULL,
- G_PARAM_READWRITE
- | G_PARAM_STATIC_STRINGS));
-
- /**
- * XfceHeading:title:
- *
- * The title text to display in the heading.
- *
- * Since: 4.4.0
- **/
- g_object_class_install_property (gobject_class,
- PROP_TITLE,
- g_param_spec_string ("title",
- "title",
- "title",
- NULL,
- G_PARAM_READWRITE
- | G_PARAM_STATIC_STRINGS));
-}
-
-
-
-static void
-xfce_heading_init (XfceHeading *heading)
-{
- /* setup the private data */
- heading->priv = XFCE_HEADING_GET_PRIVATE (heading);
-
- /* setup the widget parameters */
- GTK_WIDGET_UNSET_FLAGS (heading, GTK_NO_WINDOW);
-}
-
-
-
-static void
-xfce_heading_finalize (GObject *object)
-{
- XfceHeading *heading = XFCE_HEADING (object);
-
- /* release the private data */
- if (G_UNLIKELY (heading->priv->icon != NULL))
- g_object_unref (G_OBJECT (heading->priv->icon));
-
- g_free (heading->priv->icon_name);
- g_free (heading->priv->subtitle);
- g_free (heading->priv->title);
-
- (*G_OBJECT_CLASS (xfce_heading_parent_class)->finalize) (object);
-}
-
-
-
-static void
-xfce_heading_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- XfceHeading *heading = XFCE_HEADING (object);
-
- switch (prop_id)
- {
- case PROP_ICON:
- g_value_set_object (value, xfce_heading_get_icon (heading));
- break;
-
- case PROP_ICON_NAME:
- g_value_set_string (value, xfce_heading_get_icon_name (heading));
- break;
-
- case PROP_SUBTITLE:
- g_value_set_string (value, xfce_heading_get_subtitle (heading));
- break;
-
- case PROP_TITLE:
- g_value_set_string (value, xfce_heading_get_title (heading));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-
-static void
-xfce_heading_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- XfceHeading *heading = XFCE_HEADING (object);
-
- switch (prop_id)
- {
- case PROP_ICON:
- xfce_heading_set_icon (heading, g_value_get_object (value));
- break;
-
- case PROP_ICON_NAME:
- xfce_heading_set_icon_name (heading, g_value_get_string (value));
- break;
-
- case PROP_SUBTITLE:
- xfce_heading_set_subtitle (heading, g_value_get_string (value));
- break;
-
- case PROP_TITLE:
- xfce_heading_set_title (heading, g_value_get_string (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-
-static void
-xfce_heading_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
-
- /* mark the widget as realized */
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- /* setup the window attributes */
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK;
-
- /* allocate the widget window */
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
- GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
- gdk_window_set_user_data (widget->window, widget);
-
- /* connect the style to the window */
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- /* set background color (using the base color) */
- gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
-}
-
-
-
-static void
-xfce_heading_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- XfceHeading *heading = XFCE_HEADING (widget);
- PangoLayout *layout;
- GdkPixbuf *pixbuf;
- gint layout_width;
- gint layout_height;
- gint pixbuf_width = 0;
- gint pixbuf_height = 0;
-
- /* determine the dimensions of the title text */
- layout = xfce_heading_make_layout (heading);
- pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
- g_object_unref (G_OBJECT (layout));
-
- /* determine the dimensions of the pixbuf */
- pixbuf = xfce_heading_make_pixbuf (heading);
- if (G_LIKELY (pixbuf != NULL))
- {
- pixbuf_width = gdk_pixbuf_get_width (pixbuf);
- pixbuf_height = gdk_pixbuf_get_height (pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
- }
-
- /* determine the base dimensions */
- requisition->width = layout_width + pixbuf_width + ((pixbuf_width > 0) ? XFCE_HEADING_SPACING : 0);
- requisition->height = MAX (XFCE_HEADING_ICON_SIZE, MAX (pixbuf_height, layout_height));
-
- /* add border size */
- requisition->width += 2 * XFCE_HEADING_BORDER;
- requisition->height += 2 * XFCE_HEADING_BORDER;
-}
-
-
-
-static void
-xfce_heading_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- /* check if we're already realized */
- if (GTK_WIDGET_REALIZED (widget))
- {
- /* set background color (using the base color) */
- gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
- }
-}
-
-
-
-static gboolean
-xfce_heading_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- XfceHeading *heading = XFCE_HEADING (widget);
- PangoLayout *layout;
- GdkPixbuf *pixbuf;
- gboolean rtl;
- gint width;
- gint height;
- gint x;
- gint y;
-
- /* check if we should render from right to left */
- rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
-
- /* determine the initial horizontal position */
- x = (rtl ? widget->allocation.width - XFCE_HEADING_BORDER : XFCE_HEADING_BORDER);
-
- /* check if we have a pixbuf to render */
- pixbuf = xfce_heading_make_pixbuf (heading);
- if (G_LIKELY (pixbuf != NULL))
- {
- /* determine the pixbuf dimensions */
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- /* determine the vertical position */
- y = (widget->allocation.height - height) / 2;
-
- /* render the pixbuf */
- gdk_draw_pixbuf (widget->window, widget->style->black_gc, pixbuf, 0, 0,
- (rtl ? x - width : x), y, width, height,
- GDK_RGB_DITHER_NORMAL, 0, 0);
-
- /* release the pixbuf */
- g_object_unref (G_OBJECT (pixbuf));
-
- /* advance the horizontal position */
- x += (rtl ? -1 : 1) * (width + XFCE_HEADING_SPACING);
- }
-
- /* generate the title layout */
- layout = xfce_heading_make_layout (heading);
- pango_layout_get_pixel_size (layout, &width, &height);
-
- /* determine the vertical position */
- y = (widget->allocation.height - height) / 2;
-
- /* render the title */
- gtk_paint_layout (widget->style, widget->window, GTK_WIDGET_STATE (widget), TRUE, &event->area,
- widget, "heading", (rtl ? x - width : x), y, layout);
-
- /* release the layout */
- g_object_unref (G_OBJECT (layout));
-
- return FALSE;
-}
-
-
-
-static AtkObject*
-xfce_heading_get_accessible (GtkWidget *widget)
-{
- AtkObject *object;
-
- object = (*GTK_WIDGET_CLASS (xfce_heading_parent_class)->get_accessible) (widget);
- atk_object_set_role (object, ATK_ROLE_HEADER);
-
- return object;
-}
-
-
-
-static PangoLayout*
-xfce_heading_make_layout (XfceHeading *heading)
-{
- PangoAttribute *attribute;
- PangoAttrList *attr_list;
- PangoLayout *layout;
- GString *text;
- gint title_length = 0;
-
- /* generate the full text */
- text = g_string_sized_new (128);
- if (G_LIKELY (heading->priv->title != NULL))
- {
- /* add the main title */
- title_length = strlen (heading->priv->title);
- g_string_append (text, heading->priv->title);
- }
- if (heading->priv->subtitle != NULL && *heading->priv->subtitle != '\0')
- {
- /* add an empty line between the title and the subtitle */
- if (G_LIKELY (heading->priv->title != NULL))
- g_string_append (text, "\n");
-
- /* add the subtitle */
- g_string_append (text, heading->priv->subtitle);
- }
-
- /* allocate and setup a new layout from the widget's context */
- layout = gtk_widget_create_pango_layout (GTK_WIDGET (heading), text->str);
-
- /* allocate an attribute list (large bold title) */
- attr_list = pango_attr_list_new ();
- attribute = pango_attr_scale_new (PANGO_SCALE_LARGE); /* large title */
- attribute->start_index = 0;
- attribute->end_index = title_length;
- pango_attr_list_insert (attr_list, attribute);
- attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD); /* bold title */
- attribute->start_index = 0;
- attribute->end_index = title_length;
- pango_attr_list_insert (attr_list, attribute);
- pango_layout_set_attributes (layout, attr_list);
- pango_attr_list_unref (attr_list);
-
- /* cleanup */
- g_string_free (text, TRUE);
-
- return layout;
-}
-
-
-
-static GdkPixbuf*
-xfce_heading_make_pixbuf (XfceHeading *heading)
-{
- GtkIconTheme *icon_theme;
- GdkPixbuf *pixbuf = NULL;
- GdkScreen *screen;
-
- if (G_UNLIKELY (heading->priv->icon != NULL))
- {
- /* just use the specified icon */
- pixbuf = g_object_ref (G_OBJECT (heading->priv->icon));
- }
- else if (G_LIKELY (heading->priv->icon_name != NULL))
- {
- /* determine the icon theme for the current screen */
- screen = gtk_widget_get_screen (GTK_WIDGET (heading));
- icon_theme = gtk_icon_theme_get_for_screen (screen);
-
- /* try to load the icon from the icon theme */
- pixbuf = gtk_icon_theme_load_icon (icon_theme, heading->priv->icon_name,
- XFCE_HEADING_ICON_SIZE,
- GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- }
-
- return pixbuf;
-}
-
-
-
-/**
- * xfce_heading_new:
- *
- * Allocates a new #XfceHeading instance.
- *
- * Return value: the newly allocated #XfceHeading.
- **/
-GtkWidget*
-xfce_heading_new (void)
-{
- return g_object_new (XFCE_TYPE_HEADING, NULL);
-}
-
-
-
-/**
- * xfce_heading_get_icon:
- * @heading : a #XfceHeading.
- *
- * Returns the #GdkPixbuf that was set as icon for
- * @heading or %NULL if no icon is set. The returned
- * #GdkPixbuf object is owned by @heading.
- *
- * Return value: the icon for @heading, or %NULL.
- **/
-static GdkPixbuf*
-xfce_heading_get_icon (XfceHeading *heading)
-{
- g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
- return heading->priv->icon;
-}
-
-
-
-/**
- * xfce_heading_set_icon:
- * @heading : a #XfceHeading.
- * @icon : the new icon or %NULL.
- *
- * If @icon is not %NULL, @heading will display the new @icon
- * aside the title. Else, if @icon is %NULL no icon is displayed
- * unless an icon name was set with xfce_heading_set_icon_name().
- **/
-void
-xfce_heading_set_icon (XfceHeading *heading,
- GdkPixbuf *icon)
-{
- g_return_if_fail (XFCE_IS_HEADING (heading));
- g_return_if_fail (icon == NULL || GDK_IS_PIXBUF (icon));
-
- /* check if we have a new icon */
- if (G_LIKELY (heading->priv->icon != icon))
- {
- /* disconnect from the previous icon */
- if (G_LIKELY (heading->priv->icon != NULL))
- g_object_unref (G_OBJECT (heading->priv->icon));
-
- /* activate the new icon */
- heading->priv->icon = icon;
-
- /* connect to the new icon */
- if (G_LIKELY (icon != NULL))
- g_object_ref (G_OBJECT (icon));
-
- /* schedule a resize */
- gtk_widget_queue_resize (GTK_WIDGET (heading));
-
- /* notify listeners */
- g_object_notify (G_OBJECT (heading), "icon");
- }
-}
-
-
-
-/**
- * xfce_heading_get_icon_name:
- * @heading : a #XfceHeading.
- *
- * Returns the icon name previously set by a call to
- * xfce_heading_set_icon_name() or %NULL if no icon name
- * is set for @heading.
- *
- * Return value: the icon name for @heading, or %NULL.
- **/
-static const gchar*
-xfce_heading_get_icon_name (XfceHeading *heading)
-{
- g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
- return heading->priv->icon_name;
-}
-
-
-
-/**
- * xfce_heading_set_icon_name:
- * @heading : a #XfceHeading.
- * @icon_name : the new icon name, or %NULL.
- *
- * If @icon_name is not %NULL and the "icon" property is set to
- * %NULL, see xfce_heading_set_icon(), the @heading will display
- * the name icon identified by the @icon_name.
- **/
-void
-xfce_heading_set_icon_name (XfceHeading *heading,
- const gchar *icon_name)
-{
- g_return_if_fail (XFCE_IS_HEADING (heading));
-
- /* release the previous icon name */
- g_free (heading->priv->icon_name);
-
- /* activate the new icon name */
- heading->priv->icon_name = g_strdup (icon_name);
-
- /* schedule a resize */
- gtk_widget_queue_resize (GTK_WIDGET (heading));
-
- /* notify listeners */
- g_object_notify (G_OBJECT (heading), "icon-name");
-}
-
-
-
-/**
- * xfce_heading_get_subtitle:
- * @heading : a #XfceHeading.
- *
- * Returns the sub title displayed below the
- * main title of the @heading, or %NULL if
- * no subtitle is set.
- *
- * Return value: the subtitle of @heading, or %NULL.
- **/
-static const gchar*
-xfce_heading_get_subtitle (XfceHeading *heading)
-{
- g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
- return heading->priv->subtitle;
-}
-
-
-
-/**
- * xfce_heading_set_subtitle:
- * @heading : a #XfceHeading.
- * @subtitle : the new subtitle for @heading, or %NULL.
- *
- * If @subtitle is not %NULL and not the empty string, it
- * will be displayed by @heading below the main title.
- **/
-void
-xfce_heading_set_subtitle (XfceHeading *heading,
- const gchar *subtitle)
-{
- g_return_if_fail (XFCE_IS_HEADING (heading));
- g_return_if_fail (subtitle == NULL || g_utf8_validate (subtitle, -1, NULL));
-
- /* release the previous subtitle */
- g_free (heading->priv->subtitle);
-
- /* activate the new subtitle */
- heading->priv->subtitle = g_strdup (subtitle);
-
- /* schedule a resize */
- gtk_widget_queue_resize (GTK_WIDGET (heading));
-
- /* notify listeners */
- g_object_notify (G_OBJECT (heading), "subtitle");
-}
-
-
-
-/**
- * xfce_heading_get_title:
- * @heading : a #XfceHeading.
- *
- * Returns the title displayed by the @heading.
- *
- * Return value: the title displayed by the @heading.
- **/
-static const gchar*
-xfce_heading_get_title (XfceHeading *heading)
-{
- g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
- return heading->priv->title;
-}
-
-
-
-/**
- * xfce_heading_set_title:
- * @heading : a #XfceHeading.
- * @title : the new title for the @heading.
- *
- * Sets the title displayed by the @heading to the
- * specified @title.
- **/
-void
-xfce_heading_set_title (XfceHeading *heading,
- const gchar *title)
-{
- g_return_if_fail (XFCE_IS_HEADING (heading));
- g_return_if_fail (title == NULL || g_utf8_validate (title, -1, NULL));
-
- /* release the previous title */
- g_free (heading->priv->title);
-
- /* activate the new title */
- heading->priv->title = g_strdup (title);
-
- /* schedule a resize */
- gtk_widget_queue_resize (GTK_WIDGET (heading));
-
- /* notify listeners */
- g_object_notify (G_OBJECT (heading), "title");
-}
diff --git a/terminal/xfce-heading.h b/terminal/xfce-heading.h
deleted file mode 100644
index 563885e..0000000
--- a/terminal/xfce-heading.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __XFCE_HEADING_H__
-#define __XFCE_HEADING_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-typedef struct _XfceHeadingPrivate XfceHeadingPrivate;
-typedef struct _XfceHeadingClass XfceHeadingClass;
-typedef struct _XfceHeading XfceHeading;
-
-#define XFCE_TYPE_HEADING (xfce_heading_get_type ())
-#define XFCE_HEADING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_HEADING, XfceHeading))
-#define XFCE_HEADING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_HEADING, XfceHeadingClass))
-#define XFCE_IS_HEADING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_HEADING))
-#define XFCE_IS_HEADING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_HEADING))
-#define XFCE_HEADING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_HEADING, XfceHeadingClass))
-
-struct _XfceHeadingClass
-{
- /*< private >*/
- GtkWidgetClass __parent__;
-};
-
-struct _XfceHeading
-{
- /*< private >*/
- GtkWidget __parent__;
- XfceHeadingPrivate *priv;
-};
-
-GType xfce_heading_get_type (void) G_GNUC_CONST;
-
-GtkWidget *xfce_heading_new (void) G_GNUC_MALLOC;
-
-void xfce_heading_set_icon (XfceHeading *heading,
- GdkPixbuf *icon);
-void xfce_heading_set_icon_name (XfceHeading *heading,
- const gchar *icon_name);
-void xfce_heading_set_subtitle (XfceHeading *heading,
- const gchar *subtitle);
-void xfce_heading_set_title (XfceHeading *heading,
- const gchar *title);
-
-G_END_DECLS
-
-#endif /* !__XFCE_HEADING_H__ */
diff --git a/terminal/xfce-titled-dialog.c b/terminal/xfce-titled-dialog.c
deleted file mode 100644
index 7093f84..0000000
--- a/terminal/xfce-titled-dialog.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*-
- * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-#include <gdk/gdkkeysyms.h>
-
-#include <terminal/xfce-heading.h>
-#include <terminal/xfce-titled-dialog.h>
-
-
-#define XFCE_TITLED_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialogPrivate))
-
-
-
-/* Property identifiers */
-enum
-{
- PROP_0,
- PROP_SUBTITLE,
-};
-
-
-
-static void xfce_titled_dialog_finalize (GObject *object);
-static void xfce_titled_dialog_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void xfce_titled_dialog_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void xfce_titled_dialog_close (GtkDialog *dialog);
-static void xfce_titled_dialog_update_heading (XfceTitledDialog *titled_dialog);
-static void xfce_titled_dialog_set_subtitle (XfceTitledDialog *titled_dialog,
- const gchar *subtitle);
-
-
-struct _XfceTitledDialogPrivate
-{
- GtkWidget *heading;
- gchar *subtitle;
-};
-
-
-
-G_DEFINE_TYPE (XfceTitledDialog, xfce_titled_dialog, GTK_TYPE_DIALOG)
-
-
-
-static void
-xfce_titled_dialog_class_init (XfceTitledDialogClass *klass)
-{
- GtkDialogClass *gtkdialog_class;
- GtkBindingSet *binding_set;
- GObjectClass *gobject_class;
-
- /* add our private data to the class */
- g_type_class_add_private (klass, sizeof (XfceTitledDialogPrivate));
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = xfce_titled_dialog_finalize;
- gobject_class->get_property = xfce_titled_dialog_get_property;
- gobject_class->set_property = xfce_titled_dialog_set_property;
-
- gtkdialog_class = GTK_DIALOG_CLASS (klass);
- gtkdialog_class->close = xfce_titled_dialog_close;
-
- /**
- * XfceTitledDialog:subtitle:
- *
- * The subtitle displayed below the main dialog title.
- **/
- g_object_class_install_property (gobject_class,
- PROP_SUBTITLE,
- g_param_spec_string ("subtitle",
- "subtitle",
- "subtitle",
- NULL,
- G_PARAM_READWRITE
- | G_PARAM_STATIC_STRINGS));
-
- /* connect additional key bindings to the GtkDialog::close action signal */
- binding_set = gtk_binding_set_by_class (klass);
- gtk_binding_entry_add_signal (binding_set, GDK_w, GDK_CONTROL_MASK, "close", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_W, GDK_CONTROL_MASK, "close", 0);
-}
-
-
-
-static void
-xfce_titled_dialog_init (XfceTitledDialog *titled_dialog)
-{
- GtkWidget *line;
- GtkWidget *vbox;
-
- /* connect the private data */
- titled_dialog->priv = XFCE_TITLED_DIALOG_GET_PRIVATE (titled_dialog);
-
- /* remove the main dialog box from the window */
- g_object_ref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
- gtk_container_remove (GTK_CONTAINER (titled_dialog), GTK_DIALOG (titled_dialog)->vbox);
-
- /* add a new vbox w/o border to the main window */
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (titled_dialog), vbox);
- gtk_widget_show (vbox);
-
- /* add the heading to the window */
- titled_dialog->priv->heading = xfce_heading_new ();
- gtk_box_pack_start (GTK_BOX (vbox), titled_dialog->priv->heading, FALSE, FALSE, 0);
- gtk_widget_show (titled_dialog->priv->heading);
-
- /* add the separator between header and content */
- line = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), line, FALSE, FALSE, 0);
- gtk_widget_show (line);
-
- /* add the main dialog box to the new vbox */
- gtk_box_pack_start (GTK_BOX (vbox), GTK_DIALOG (titled_dialog)->vbox, TRUE, TRUE, 0);
- g_object_unref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
-
- /* make sure to update the heading whenever one of the relevant window properties changes */
- g_signal_connect (G_OBJECT (titled_dialog), "notify::icon", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
- g_signal_connect (G_OBJECT (titled_dialog), "notify::icon-name", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
- g_signal_connect (G_OBJECT (titled_dialog), "notify::title", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
-
- /* initially update the heading properties */
- xfce_titled_dialog_update_heading (titled_dialog);
-}
-
-
-
-
-static void
-xfce_titled_dialog_finalize (GObject *object)
-{
- XfceTitledDialog *titled_dialog = XFCE_TITLED_DIALOG (object);
-
- /* release the subtitle */
- g_free (titled_dialog->priv->subtitle);
-
- (*G_OBJECT_CLASS (xfce_titled_dialog_parent_class)->finalize) (object);
-}
-
-
-
-static void
-xfce_titled_dialog_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- XfceTitledDialog *titled_dialog = XFCE_TITLED_DIALOG (object);
-
- switch (prop_id)
- {
- case PROP_SUBTITLE:
- g_value_set_string (value, titled_dialog->priv->subtitle);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-
-static void
-xfce_titled_dialog_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- XfceTitledDialog *titled_dialog = XFCE_TITLED_DIALOG (object);
-
- switch (prop_id)
- {
- case PROP_SUBTITLE:
- xfce_titled_dialog_set_subtitle (titled_dialog, g_value_get_string (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-
-static void
-xfce_titled_dialog_close (GtkDialog *dialog)
-{
- GdkEvent *event;
-
- /* verify that the dialog is realized */
- if (G_LIKELY (GTK_WIDGET_REALIZED (dialog)))
- {
- /* send a delete event to the dialog */
- event = gdk_event_new (GDK_DELETE);
- event->any.window = g_object_ref (GTK_WIDGET (dialog)->window);
- event->any.send_event = TRUE;
- gtk_main_do_event (event);
- gdk_event_free (event);
- }
-}
-
-
-
-static void
-xfce_titled_dialog_update_heading (XfceTitledDialog *titled_dialog)
-{
- /* update the heading properties using the window property values */
- xfce_heading_set_icon (XFCE_HEADING (titled_dialog->priv->heading), gtk_window_get_icon (GTK_WINDOW (titled_dialog)));
- xfce_heading_set_icon_name (XFCE_HEADING (titled_dialog->priv->heading), gtk_window_get_icon_name (GTK_WINDOW (titled_dialog)));
- xfce_heading_set_title (XFCE_HEADING (titled_dialog->priv->heading), gtk_window_get_title (GTK_WINDOW (titled_dialog)));
-}
-
-
-
-/**
- * xfce_titled_dialog_set_subtitle:
- * @titled_dialog : a #XfceTitledDialog.
- * @subtitle : the new subtitle for the @titled_dialog, or %NULL.
- *
- * Sets the subtitle displayed by @titled_dialog to @subtitle; if
- * @subtitle is %NULL no subtitle will be displayed by the @titled_dialog.
- **/
-static void
-xfce_titled_dialog_set_subtitle (XfceTitledDialog *titled_dialog,
- const gchar *subtitle)
-{
- g_return_if_fail (XFCE_IS_TITLED_DIALOG (titled_dialog));
- g_return_if_fail (subtitle == NULL || g_utf8_validate (subtitle, -1, NULL));
-
- /* release the previous subtitle */
- g_free (titled_dialog->priv->subtitle);
-
- /* activate the new subtitle */
- titled_dialog->priv->subtitle = g_strdup (subtitle);
-
- /* update the subtitle for the heading */
- xfce_heading_set_subtitle (XFCE_HEADING (titled_dialog->priv->heading), subtitle);
-
- /* notify listeners */
- g_object_notify (G_OBJECT (titled_dialog), "subtitle");
-}
diff --git a/terminal/xfce-titled-dialog.h b/terminal/xfce-titled-dialog.h
deleted file mode 100644
index 28f9d51..0000000
--- a/terminal/xfce-titled-dialog.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __XFCE_TITLED_DIALOG_H__
-#define __XFCE_TITLED_DIALOG_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-typedef struct _XfceTitledDialogPrivate XfceTitledDialogPrivate;
-typedef struct _XfceTitledDialogClass XfceTitledDialogClass;
-typedef struct _XfceTitledDialog XfceTitledDialog;
-
-#define XFCE_TYPE_TITLED_DIALOG (xfce_titled_dialog_get_type ())
-#define XFCE_TITLED_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialog))
-#define XFCE_TITLED_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialogClass))
-#define XFCE_IS_TITLED_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_TITLED_DIALOG))
-#define XFCE_IS_TITLED_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_TITLED_DIALOG))
-#define XFCE_TITLED_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialogClass))
-
-struct _XfceTitledDialogClass
-{
- /*< private >*/
- GtkDialogClass __parent__;
-
- /* reserved for future expansion */
- void (*reserved0) (void);
- void (*reserved1) (void);
- void (*reserved2) (void);
- void (*reserved3) (void);
- void (*reserved4) (void);
- void (*reserved5) (void);
-};
-
-struct _XfceTitledDialog
-{
- /*< private >*/
- GtkDialog __parent__;
- XfceTitledDialogPrivate *priv;
-};
-
-GType xfce_titled_dialog_get_type (void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* !__XFCE_TITLED_DIALOG_H__ */
More information about the Xfce4-commits
mailing list