[Goodies-commits] r7599 - in xfmpc/trunk: . src
Vincent Legout
vincent at xfce.org
Tue Jun 16 20:51:39 CEST 2009
Author: vincent
Date: 2009-06-16 18:51:39 +0000 (Tue, 16 Jun 2009)
New Revision: 7599
Added:
xfmpc/trunk/src/config.vapi
xfmpc/trunk/src/mpdclient.vapi
xfmpc/trunk/src/preferences.vapi
xfmpc/trunk/src/xfce-arrow-button.vapi
Removed:
xfmpc/trunk/src/main-ui.h
xfmpc/trunk/src/main-ui.xml
xfmpc/trunk/vapi/
Modified:
xfmpc/trunk/ChangeLog
xfmpc/trunk/configure.in.in
xfmpc/trunk/src/Makefile.am
xfmpc/trunk/src/dbbrowser.c
xfmpc/trunk/src/dbbrowser.vala
xfmpc/trunk/src/extended-interface.vala
xfmpc/trunk/src/interface.vala
xfmpc/trunk/src/main-window.c
xfmpc/trunk/src/main-window.vala
xfmpc/trunk/src/main.c
xfmpc/trunk/src/playlist.vala
xfmpc/trunk/src/preferences-dialog.c
xfmpc/trunk/src/preferences-dialog.vala
xfmpc/trunk/src/song-dialog.vala
xfmpc/trunk/src/statusbar.vala
xfmpc/trunk/src/xfmpc.h
Log:
General cleanup and add dependency on xfce4-vala
Removed the vapi/ dir because Xfmpc now depends on xfce4-vala. The others vapi
files have been moved to src/.
Removed main-ui.h and main-ui.xml. The code has been moved to main-window.vala.
Modified: xfmpc/trunk/ChangeLog
===================================================================
--- xfmpc/trunk/ChangeLog 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/ChangeLog 2009-06-16 18:51:39 UTC (rev 7599)
@@ -1,3 +1,11 @@
+2009-06-16 Vincent Legout <vincent at legout.info>
+
+General cleanup and add dependency on xfce4-vala
+
+Removed the vapi/ dir because Xfmpc now depends on xfce4-vala. The others vapi
+files have been moved to src/.
+Removed main-ui.h and main-ui.xml. The code has been moved to main-window.vala.
+
2009-06-15 Mike Massonnet <mmassonne at xfce.org>
Fix build problem for Gettext
Modified: xfmpc/trunk/configure.in.in
===================================================================
--- xfmpc/trunk/configure.in.in 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/configure.in.in 2009-06-16 18:51:39 UTC (rev 7599)
@@ -76,6 +76,7 @@
echo "***"
echo
fi
+ XDT_CHECK_PACKAGE([XFCE4VALA], [xfce4-vala], [0.1])
fi
dnl ***********************************
Modified: xfmpc/trunk/src/Makefile.am
===================================================================
--- xfmpc/trunk/src/Makefile.am 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/Makefile.am 2009-06-16 18:51:39 UTC (rev 7599)
@@ -1,5 +1,7 @@
bin_PROGRAMS = xfmpc
+if MAINTAINER_MODE
+
xfmpc_VALASOURCES = \
preferences-dialog.vala \
song-dialog.vala \
@@ -11,22 +13,13 @@
playlist.vala
vala_built_SOURCES = \
- $(xfmpc_VALASOURCES:.vala=.c) \
- $(xfmpc_VALASOURCES:.vala=.h)
+ $(xfmpc_VALASOURCES:.vala=.c)
-if MAINTAINER_MODE
-
-BUILT_SOURCES = \
- main-ui.h \
- vala.stamp
-
+BUILT_SOURCES = vala.stamp
vala.stamp: $(xfmpc_VALASOURCES)
- $(VALAC) --vapidir=$(top_srcdir)/vapi --pkg=gtk+-2.0 --pkg=libxfce4util-1.0 --pkg=libxfcegui4-1.0 --pkg=config --pkg=mpdclient --pkg=preferences --pkg=xfce-arrow-button $^ -C -H xfmpc.h
+ $(VALAC) --vapidir=. --pkg=libxfcegui4-1.0 --pkg=config --pkg=mpdclient --pkg=preferences --pkg=xfce-arrow-button $^ -C -H xfmpc.h
touch $@
-main-ui.h: Makefile $(srcdir)/main-ui.xml
- exo-csource --strip-comments --strip-content --static --name=main_ui $(srcdir)/main-ui.xml > main-ui.h
-
endif
xfmpc_SOURCES = \
@@ -62,11 +55,10 @@
-DSRCDIR=\""$(top_srcdir)"\"
EXTRA_DIST = \
- main-ui.xml \
$(xfmpc_VALASOURCES)
-DISTCLEANFILES = \
- main-ui.h \
+CLEANFILES = \
$(BUILT_SOURCES) \
- $(vala_built_SOURCES)
+ $(vala_built_SOURCES) \
+ xfmpc.h
Added: xfmpc/trunk/src/config.vapi
===================================================================
--- xfmpc/trunk/src/config.vapi (rev 0)
+++ xfmpc/trunk/src/config.vapi 2009-06-16 18:51:39 UTC (rev 7599)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2009 Mike Massonnet <mmassonnet at xfce.org>
+ * Copyright (c) 2009 Vincent Legout <vincent at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+[CCode (cprefix="", lower_case_prefix="", cheader_filename="config.h")]
+namespace Config {
+ [CCode (cname = "GETTEXT_PACKAGE")]
+ public const string GETTEXT_PACKAGE;
+ [CCode (cname = "PACKAGE_LOCALE_DIR")]
+ public const string PACKAGE_LOCALE_DIR;
+ [CCode (cname = "PACKAGE_VERSION")]
+ public const string PACKAGE_VERSION;
+ [CCode (cname = "PACKAGE_STRING")]
+ public const string PACKAGE_STRING;
+ [CCode (cname = "PACKAGE_NAME")]
+ public const string PACKAGE_NAME;
+}
Modified: xfmpc/trunk/src/dbbrowser.c
===================================================================
--- xfmpc/trunk/src/dbbrowser.c 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/dbbrowser.c 2009-06-16 18:51:39 UTC (rev 7599)
@@ -84,7 +84,6 @@
XFMPC_DBBROWSER_DUMMY_PROPERTY
};
static GType xfmpc_dbbrowser_columns_get_type (void);
-void xfmpc_dbbrowser_free (XfmpcDbbrowser* self);
static void xfmpc_dbbrowser_clear (XfmpcDbbrowser* self);
gboolean xfmpc_dbbrowser_wdir_is_root (XfmpcDbbrowser* self);
char* xfmpc_dbbrowser_get_parent_wdir (XfmpcDbbrowser* self);
@@ -142,11 +141,6 @@
}
-void xfmpc_dbbrowser_free (XfmpcDbbrowser* self) {
- g_return_if_fail (self != NULL);
-}
-
-
void xfmpc_dbbrowser_reload (XfmpcDbbrowser* self) {
char* filename;
char* basename;
@@ -785,30 +779,36 @@
{
char* _tmp1_;
const char* _tmp0_;
- char* _tmp2_;
- GtkListStore* _tmp3_;
- GtkTreeView* _tmp4_;
+ GtkListStore* _tmp4_;
+ GtkTreeView* _tmp5_;
GtkCellRendererPixbuf* cell_pixbuf;
GtkCellRendererText* cell_text;
GtkScrolledWindow* scrolled;
- GtkMenu* _tmp5_;
+ GtkMenu* _tmp6_;
GtkImageMenuItem* mi;
- GtkImageMenuItem* _tmp6_;
+ GtkImageMenuItem* _tmp7_;
GtkImage* image;
- GtkImageMenuItem* _tmp7_;
- GtkImage* _tmp8_;
- GtkEntry* _tmp9_;
+ GtkImageMenuItem* _tmp8_;
+ GtkImage* _tmp9_;
+ GtkEntry* _tmp10_;
self->priv->mpdclient = xfmpc_mpdclient_get ();
self->priv->preferences = xfmpc_preferences_get ();
_tmp1_ = NULL;
_tmp0_ = NULL;
self->priv->wdir = (_tmp1_ = (_tmp0_ = xfmpc_preferences_get_dbbrowser_last_path (self->priv->preferences), (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_)), self->priv->wdir = (g_free (self->priv->wdir), NULL), _tmp1_);
- _tmp2_ = NULL;
- self->priv->last_wdir = (_tmp2_ = g_strndup (self->priv->wdir, (gsize) g_utf8_strlen (self->priv->wdir, -1)), self->priv->last_wdir = (g_free (self->priv->last_wdir), NULL), _tmp2_);
- _tmp3_ = NULL;
- self->priv->store = (_tmp3_ = gtk_list_store_new ((gint) XFMPC_DBBROWSER_COLUMNS_N_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT, NULL), (self->priv->store == NULL) ? NULL : (self->priv->store = (g_object_unref (self->priv->store), NULL)), _tmp3_);
+ if (self->priv->wdir != NULL) {
+ char* _tmp2_;
+ _tmp2_ = NULL;
+ self->priv->last_wdir = (_tmp2_ = g_strndup (self->priv->wdir, (gsize) g_utf8_strlen (self->priv->wdir, -1)), self->priv->last_wdir = (g_free (self->priv->last_wdir), NULL), _tmp2_);
+ } else {
+ char* _tmp3_;
+ _tmp3_ = NULL;
+ self->priv->last_wdir = (_tmp3_ = g_strdup (""), self->priv->last_wdir = (g_free (self->priv->last_wdir), NULL), _tmp3_);
+ }
_tmp4_ = NULL;
- self->priv->treeview = (_tmp4_ = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()), (self->priv->treeview == NULL) ? NULL : (self->priv->treeview = (g_object_unref (self->priv->treeview), NULL)), _tmp4_);
+ self->priv->store = (_tmp4_ = gtk_list_store_new ((gint) XFMPC_DBBROWSER_COLUMNS_N_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT, NULL), (self->priv->store == NULL) ? NULL : (self->priv->store = (g_object_unref (self->priv->store), NULL)), _tmp4_);
+ _tmp5_ = NULL;
+ self->priv->treeview = (_tmp5_ = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()), (self->priv->treeview == NULL) ? NULL : (self->priv->treeview = (g_object_unref (self->priv->treeview), NULL)), _tmp5_);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (self->priv->treeview), GTK_SELECTION_MULTIPLE);
gtk_tree_view_set_rubber_banding (self->priv->treeview, TRUE);
gtk_tree_view_set_enable_search (self->priv->treeview, TRUE);
@@ -823,27 +823,27 @@
gtk_tree_view_insert_column_with_attributes (self->priv->treeview, -1, "Filename", (GtkCellRenderer*) cell_text, "text", XFMPC_DBBROWSER_COLUMNS_COLUMN_BASENAME, "weight", XFMPC_DBBROWSER_COLUMNS_COLUMN_WEIGHT, NULL, NULL);
scrolled = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL));
gtk_scrolled_window_set_policy (scrolled, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- _tmp5_ = NULL;
- self->priv->menu = (_tmp5_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), (self->priv->menu == NULL) ? NULL : (self->priv->menu = (g_object_unref (self->priv->menu), NULL)), _tmp5_);
+ _tmp6_ = NULL;
+ self->priv->menu = (_tmp6_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), (self->priv->menu == NULL) ? NULL : (self->priv->menu = (g_object_unref (self->priv->menu), NULL)), _tmp6_);
mi = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_ADD, NULL));
gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) mi));
g_signal_connect_object ((GtkMenuItem*) mi, "activate", (GCallback) _xfmpc_dbbrowser_add_selected_rows_gtk_menu_item_activate, self, 0);
- _tmp6_ = NULL;
- mi = (_tmp6_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_with_mnemonic (_ ("Replace"))), (mi == NULL) ? NULL : (mi = (g_object_unref (mi), NULL)), _tmp6_);
+ _tmp7_ = NULL;
+ mi = (_tmp7_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_with_mnemonic (_ ("Replace"))), (mi == NULL) ? NULL : (mi = (g_object_unref (mi), NULL)), _tmp7_);
image = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU));
gtk_image_menu_item_set_image (mi, (GtkWidget*) image);
gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) mi));
g_signal_connect_object ((GtkMenuItem*) mi, "activate", (GCallback) _xfmpc_dbbrowser_cb_replace_with_selected_rows_gtk_menu_item_activate, self, 0);
- _tmp7_ = NULL;
- self->priv->mi_browse = (_tmp7_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_with_mnemonic (_ ("Browse"))), (self->priv->mi_browse == NULL) ? NULL : (self->priv->mi_browse = (g_object_unref (self->priv->mi_browse), NULL)), _tmp7_);
_tmp8_ = NULL;
- image = (_tmp8_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU)), (image == NULL) ? NULL : (image = (g_object_unref (image), NULL)), _tmp8_);
+ self->priv->mi_browse = (_tmp8_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_with_mnemonic (_ ("Browse"))), (self->priv->mi_browse == NULL) ? NULL : (self->priv->mi_browse = (g_object_unref (self->priv->mi_browse), NULL)), _tmp8_);
+ _tmp9_ = NULL;
+ image = (_tmp9_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU)), (image == NULL) ? NULL : (image = (g_object_unref (image), NULL)), _tmp9_);
gtk_image_menu_item_set_image (self->priv->mi_browse, (GtkWidget*) image);
gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) self->priv->mi_browse));
g_signal_connect_object ((GtkMenuItem*) self->priv->mi_browse, "activate", (GCallback) _xfmpc_dbbrowser_cb_browse_gtk_menu_item_activate, self, 0);
gtk_widget_show_all ((GtkWidget*) self->priv->menu);
- _tmp9_ = NULL;
- self->priv->search_entry = (_tmp9_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->search_entry == NULL) ? NULL : (self->priv->search_entry = (g_object_unref (self->priv->search_entry), NULL)), _tmp9_);
+ _tmp10_ = NULL;
+ self->priv->search_entry = (_tmp10_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->search_entry == NULL) ? NULL : (self->priv->search_entry = (g_object_unref (self->priv->search_entry), NULL)), _tmp10_);
gtk_container_add ((GtkContainer*) scrolled, (GtkWidget*) self->priv->treeview);
gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) scrolled, TRUE, TRUE, (guint) 0);
gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) self->priv->search_entry, FALSE, FALSE, (guint) 0);
Modified: xfmpc/trunk/src/dbbrowser.vala
===================================================================
--- xfmpc/trunk/src/dbbrowser.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/dbbrowser.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -26,11 +26,11 @@
private unowned Xfmpc.Mpdclient mpdclient;
private unowned Xfmpc.Preferences preferences;
- private ListStore store;
- private TreeView treeview;
- private Menu menu;
- private Entry search_entry;
- private ImageMenuItem mi_browse;
+ private Gtk.ListStore store;
+ private Gtk.TreeView treeview;
+ private Gtk.Menu menu;
+ private Gtk.Entry search_entry;
+ private Gtk.ImageMenuItem mi_browse;
private string wdir;
private string last_wdir;
@@ -49,115 +49,115 @@
}
construct {
- mpdclient = Xfmpc.Mpdclient.get ();
- preferences = Xfmpc.Preferences.get ();
+ this.mpdclient = Xfmpc.Mpdclient.get ();
+ this.preferences = Xfmpc.Preferences.get ();
- wdir = preferences.dbbrowser_last_path;
- last_wdir = wdir.ndup (wdir.len ());
+ this.wdir = preferences.dbbrowser_last_path;
+ if (this.wdir != null)
+ this.last_wdir = this.wdir.ndup (this.wdir.len ());
+ else
+ this.last_wdir = "";
- store = new ListStore (Columns.N_COLUMNS,
- typeof (int),
- typeof (Gdk.Pixbuf),
- typeof (string),
- typeof (string),
- typeof (bool),
- typeof (int));
+ this.store = new Gtk.ListStore (Columns.N_COLUMNS,
+ typeof (int),
+ typeof (Gdk.Pixbuf),
+ typeof (string),
+ typeof (string),
+ typeof (bool),
+ typeof (int));
- treeview = new TreeView ();
- (treeview.get_selection ()).set_mode (SelectionMode.MULTIPLE);
- treeview.set_rubber_banding (true);
- treeview.set_enable_search (true);
- treeview.set_search_column (Columns.COLUMN_BASENAME);
- treeview.set_headers_visible (false);
- treeview.set_rules_hint (true);
- treeview.set_model (store);
+ this.treeview = new Gtk.TreeView ();
+ (this.treeview.get_selection ()).set_mode (Gtk.SelectionMode.MULTIPLE);
+ this.treeview.set_rubber_banding (true);
+ this.treeview.set_enable_search (true);
+ this.treeview.set_search_column (Columns.COLUMN_BASENAME);
+ this.treeview.set_headers_visible (false);
+ this.treeview.set_rules_hint (true);
+ this.treeview.set_model (this.store);
- var cell_pixbuf = new CellRendererPixbuf ();
- treeview.insert_column_with_attributes (-1, "", cell_pixbuf,
- "pixbuf", Columns.COLUMN_PIXBUF,
- null);
+ var cell_pixbuf = new Gtk.CellRendererPixbuf ();
+ this.treeview.insert_column_with_attributes (-1, "", cell_pixbuf,
+ "pixbuf", Columns.COLUMN_PIXBUF,
+ null);
- var cell_text = new CellRendererText ();
+ var cell_text = new Gtk.CellRendererText ();
cell_text.ellipsize = Pango.EllipsizeMode.END;
- treeview.insert_column_with_attributes (-1, "Filename", cell_text,
- "text", Columns.COLUMN_BASENAME,
- "weight", Columns.COLUMN_WEIGHT,
- null);
+ this.treeview.insert_column_with_attributes (-1, "Filename", cell_text,
+ "text", Columns.COLUMN_BASENAME,
+ "weight", Columns.COLUMN_WEIGHT,
+ null);
- var scrolled = new ScrolledWindow (null, null);
- scrolled.set_policy (PolicyType.AUTOMATIC, PolicyType.ALWAYS);
+ var scrolled = new Gtk.ScrolledWindow (null, null);
+ scrolled.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS);
- menu = new Menu ();
+ this.menu = new Gtk.Menu ();
- var mi = new ImageMenuItem.from_stock (STOCK_ADD, null);
- menu.append (mi);
+ var mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ADD, null);
+ this.menu.append (mi);
mi.activate += add_selected_rows;
- mi = new ImageMenuItem.with_mnemonic (_("Replace"));
- var image = new Image.from_stock (STOCK_CUT, IconSize.MENU);
+ mi = new Gtk.ImageMenuItem.with_mnemonic (_("Replace"));
+ var image = new Gtk.Image.from_stock (Gtk.STOCK_CUT, Gtk.IconSize.MENU);
mi.set_image (image);
- menu.append (mi);
+ this.menu.append (mi);
mi.activate += cb_replace_with_selected_rows;
- mi_browse = new ImageMenuItem.with_mnemonic (_("Browse"));
- image = new Image.from_stock (STOCK_OPEN, IconSize.MENU);
- mi_browse.set_image (image);
- menu.append (mi_browse);
- mi_browse.activate += cb_browse;
+ this.mi_browse = new Gtk.ImageMenuItem.with_mnemonic (_("Browse"));
+ image = new Gtk.Image.from_stock (Gtk.STOCK_OPEN, Gtk.IconSize.MENU);
+ this.mi_browse.set_image (image);
+ this.menu.append (this.mi_browse);
+ this.mi_browse.activate += cb_browse;
- menu.show_all ();
+ this.menu.show_all ();
- search_entry = new Entry ();
+ this.search_entry = new Entry ();
- scrolled.add (treeview);
+ scrolled.add (this.treeview);
pack_start (scrolled, true, true, 0);
- pack_start (search_entry, false, false, 0);
+ pack_start (this.search_entry, false, false, 0);
/* Signals */
- mpdclient.connected += reload;
- mpdclient.database_changed += reload;
- mpdclient.playlist_changed += cb_playlist_changed;
+ this.mpdclient.connected += reload;
+ this.mpdclient.database_changed += reload;
+ this.mpdclient.playlist_changed += cb_playlist_changed;
- treeview.row_activated += cb_row_activated;
- treeview.key_press_event += cb_key_pressed;
- treeview.button_press_event += cb_button_released;
- treeview.popup_menu += cb_popup_menu;
+ this.treeview.row_activated += cb_row_activated;
+ this.treeview.key_press_event += cb_key_pressed;
+ this.treeview.button_press_event += cb_button_released;
+ this.treeview.popup_menu += cb_popup_menu;
- search_entry.activate += cb_search_entry_activated;
- search_entry.key_release_event += cb_search_entry_key_released;
- search_entry.changed += cb_search_entry_changed;
+ this.search_entry.activate += cb_search_entry_activated;
+ this.search_entry.key_release_event += cb_search_entry_key_released;
+ this.search_entry.changed += cb_search_entry_changed;
- preferences.notify["song-format"] += reload;
- preferences.notify["song-format-custom"] += reload;
+ this.preferences.notify["song-format"] += reload;
+ this.preferences.notify["song-format-custom"] += reload;
}
- public void free () {
- }
-
public void reload () {
string filename = "", basename = "";
bool is_dir = false, is_bold = false;
int i = 0;
- if (!mpdclient.is_connected ())
+ if (!this.mpdclient.is_connected ())
return;
- if (is_searching)
+ if (this.is_searching)
return;
clear ();
- if (!wdir_is_root ()) {
+ if (!this.wdir_is_root ()) {
filename = get_parent_wdir ();
append (filename, "..", true, false);
i ++;
}
- while (mpdclient.database_read (wdir, &filename, &basename, &is_dir)) {
- is_bold = mpdclient.playlist_has_filename (filename, is_dir);
+ while (this.mpdclient.database_read (wdir, &filename, &basename, &is_dir)) {
+ is_bold = this.mpdclient.playlist_has_filename (filename, is_dir);
append (filename, basename, is_dir, is_bold);
if (filename.collate (last_wdir) == 0) {
var path = new TreePath.from_indices (i, -1);
- treeview.set_cursor (path, null, false);
- treeview.scroll_to_cell (path, null, true, (float) 0.10, 0);
+ this.treeview.set_cursor (path, null, false);
+ this.treeview.scroll_to_cell (path, null, true, (float) 0.10, 0);
i = -1;
}
else
@@ -166,7 +166,7 @@
}
public bool wdir_is_root () {
- return (wdir == "");
+ return (this.wdir == "");
}
public string get_parent_wdir () {
@@ -175,45 +175,45 @@
if (filename == null)
return "";
else
- return Path.get_dirname (wdir);
+ return GLib.Path.get_dirname (wdir);
}
public void append (string filename, string basename, bool is_dir, bool is_bold) {
- TreeIter iter;
+ Gtk.TreeIter iter;
- var pixbuf = treeview.render_icon (is_dir ? STOCK_DIRECTORY : STOCK_FILE,
- IconSize.MENU, null);
+ var pixbuf = this.treeview.render_icon (is_dir ? Gtk.STOCK_DIRECTORY : Gtk.STOCK_FILE,
+ Gtk.IconSize.MENU, null);
- store.append (out iter);
- store.set (iter,
- Columns.COLUMN_PIXBUF, pixbuf,
- Columns.COLUMN_FILENAME, filename,
- Columns.COLUMN_BASENAME, basename,
- Columns.COLUMN_IS_DIR, is_dir,
- Columns.COLUMN_WEIGHT, is_bold ? Pango.Weight.BOLD : Pango.Weight.NORMAL,
- -1);
+ this.store.append (out iter);
+ this.store.set (iter,
+ Columns.COLUMN_PIXBUF, pixbuf,
+ Columns.COLUMN_FILENAME, filename,
+ Columns.COLUMN_BASENAME, basename,
+ Columns.COLUMN_IS_DIR, is_dir,
+ Columns.COLUMN_WEIGHT, is_bold ? Pango.Weight.BOLD : Pango.Weight.NORMAL,
+ -1);
}
public void set_wdir (string dir) {
- last_wdir = wdir;
- wdir = dir;
+ this.last_wdir = this.wdir;
+ this.wdir = dir;
}
public void add_selected_rows () {
- TreeModel model = store;
- TreeIter iter;
+ Gtk.TreeModel model = this.store;
+ Gtk.TreeIter iter;
string filename = "";
- var list = (treeview.get_selection ()).get_selected_rows (out model);
+ var list = (this.treeview.get_selection ()).get_selected_rows (out model);
- foreach (TreePath path in list) {
+ foreach (Gtk.TreePath path in list) {
if (model.get_iter (out iter, path)) {
model.get (iter, Columns.COLUMN_FILENAME, out filename, -1);
- mpdclient.queue_add (filename);
+ this.mpdclient.queue_add (filename);
}
}
- mpdclient.queue_commit ();
+ this.mpdclient.queue_commit ();
}
public void search (string query) {
@@ -221,14 +221,14 @@
bool is_bold;
int i = 0;
- if (!mpdclient.is_connected ())
+ if (!this.mpdclient.is_connected ())
return;
- is_searching = true;
+ this.is_searching = true;
clear ();
- while (mpdclient.database_search (query, &filename, &basename)) {
- is_bold = mpdclient.playlist_has_filename (filename, false);
+ while (this.mpdclient.database_search (query, &filename, &basename)) {
+ is_bold = this.mpdclient.playlist_has_filename (filename, false);
append (filename, basename, false, is_bold);
i++;
}
@@ -248,51 +248,51 @@
if (no_result == no_result_buf && no_result) {
#if MORE_FUNKY_COLOR_ON_SEARCH_ENTRY
- search_entry.modify_base (StateType.NORMAL, color);
+ this.search_entry.modify_base (Gtk.StateType.NORMAL, color);
#endif
- search_entry.modify_bg (StateType.NORMAL, color);
- search_entry.modify_bg (StateType.SELECTED, color);
+ this.search_entry.modify_bg (Gtk.StateType.NORMAL, color);
+ this.search_entry.modify_bg (Gtk.StateType.SELECTED, color);
}
else if (no_result == no_result_buf && !no_result) {
#if MORE_FUNKY_COLOR_ON_SEARCH_ENTRY
- search_entry.modify_base (StateType.NORMAL, null);
+ this.search_entry.modify_base (Gtk.StateType.NORMAL, null);
#endif
- search_entry.modify_bg (StateType.NORMAL, null);
- search_entry.modify_bg (StateType.SELECTED, null);
+ this.search_entry.modify_bg (Gtk.StateType.NORMAL, null);
+ this.search_entry.modify_bg (Gtk.StateType.SELECTED, null);
}
if (i == 0) {
#if MORE_FUNKY_COLOR_ON_SEARCH_ENTRY
- search_entry.modify_base (StateType.NORMAL, color);
+ this.search_entry.modify_base (Gtk.StateType.NORMAL, color);
#endif
- search_entry.modify_bg (StateType.NORMAL, color);
- search_entry.modify_bg (StateType.SELECTED, color);
+ this.search_entry.modify_bg (Gtk.StateType.NORMAL, color);
+ this.search_entry.modify_bg (Gtk.StateType.SELECTED, color);
}
else if (no_result) {
#if MORE_FUNKY_COLOR_ON_SEARCH_ENTRY
- search_entry.modify_base (StateType.NORMAL, null);
+ this.search_entry.modify_base (Gtk.StateType.NORMAL, null);
#endif
- search_entry.modify_bg (StateType.NORMAL, null);
- search_entry.modify_bg (StateType.SELECTED, null);
+ this.search_entry.modify_bg (Gtk.StateType.NORMAL, null);
+ this.search_entry.modify_bg (Gtk.StateType.SELECTED, null);
}
}
private void clear () {
- store.clear ();
+ this.store.clear ();
}
private void menu_popup () {
- var selection = treeview.get_selection ();
+ var selection = this.treeview.get_selection ();
int count = selection.count_selected_rows ();
- if (is_searching) {
- mi_browse.show ();
- mi_browse.set_sensitive (count == 1 ? true : false);
+ if (this.is_searching) {
+ this.mi_browse.show ();
+ this.mi_browse.set_sensitive (count == 1 ? true : false);
}
else
- mi_browse.hide ();
+ this.mi_browse.hide ();
- menu.popup (null, null, null, 0, get_current_event_time ());
+ this.menu.popup (null, null, null, 0, get_current_event_time ());
}
/*
@@ -300,8 +300,8 @@
*/
private void cb_playlist_changed () {
- TreeModel model = store;
- TreeIter iter;
+ Gtk.TreeModel model = this.store;
+ Gtk.TreeIter iter;
string filename = "";
bool is_bold = false, is_dir = false;
@@ -314,7 +314,7 @@
Columns.COLUMN_IS_DIR, out is_dir,
-1);
- is_bold = mpdclient.playlist_has_filename (filename, is_dir);
+ is_bold = this.mpdclient.playlist_has_filename (filename, is_dir);
store.set (iter,
Columns.COLUMN_WEIGHT,
is_bold ? Pango.Weight.BOLD : Pango.Weight.NORMAL,
@@ -333,7 +333,7 @@
switch (event.keyval) {
case 0xff0d:
- var selection = treeview.get_selection ();
+ var selection = this.treeview.get_selection ();
if (selection.count_selected_rows () > 1)
add_selected_rows ();
else
@@ -357,13 +357,13 @@
if (event.type != Gdk.EventType.BUTTON_PRESS || event.button != 3)
return false;
- TreePath path;
- var selection = treeview.get_selection ();
+ Gtk.TreePath path;
+ var selection = this.treeview.get_selection ();
if (selection.count_selected_rows () < 1)
return true;
- if (treeview.get_path_at_pos ((int) event.x, (int) event.y,
- out path, null, null, null))
+ if (this.treeview.get_path_at_pos ((int) event.x, (int) event.y,
+ out path, null, null, null))
{
if (!selection.path_is_selected (path)) {
selection.unselect_all ();
@@ -377,9 +377,9 @@
}
private void cb_row_activated (TreePath path, TreeViewColumn column) {
- TreePath ppath = path;
- TreeModel model = store;
- TreeIter iter;
+ Gtk.TreePath ppath = path;
+ Gtk.TreeModel model = this.store;
+ Gtk.TreeIter iter;
string filename = "";
bool is_dir = false;
@@ -395,21 +395,21 @@
set_wdir (filename);
reload ();
} else {
- mpdclient.queue_add (filename);
- mpdclient.queue_commit ();
+ this.mpdclient.queue_add (filename);
+ this.mpdclient.queue_commit ();
}
}
private void cb_replace_with_selected_rows () {
- mpdclient.queue_clear ();
+ this.mpdclient.queue_clear ();
add_selected_rows ();
}
private void cb_browse () {
- TreeModel model = store;
- TreeIter iter;
+ Gtk.TreeModel model = this.store;
+ Gtk.TreeIter iter;
- var selection = treeview.get_selection ();
+ var selection = this.treeview.get_selection ();
if (selection.count_selected_rows () > 1)
return;
@@ -425,18 +425,18 @@
}
private void cb_search_entry_activated () {
- string entry_text = search_entry.get_text ();
+ string entry_text = this.search_entry.get_text ();
if (entry_text == "") {
- is_searching = false;
+ this.is_searching = false;
reload ();
/* revert possible previous applied color */
#if MORE_FUNKY_COLOR_ON_SEARCH_ENTRY
- search_entry.modify_base (StateType.NORMAL, null);
+ this.search_entry.modify_base (Gtk.StateType.NORMAL, null);
#endif
- search_entry.modify_bg (StateType.NORMAL, null);
- search_entry.modify_bg (StateType.SELECTED, null);
+ this.search_entry.modify_bg (Gtk.StateType.NORMAL, null);
+ this.search_entry.modify_bg (Gtk.StateType.SELECTED, null);
return;
}
@@ -456,10 +456,10 @@
}
private void cb_search_entry_changed () {
- if (search_timeout > 0)
- Source.remove (search_timeout);
+ if (this.search_timeout > 0)
+ GLib.Source.remove (search_timeout);
- search_timeout = Timeout.add_full (Priority.DEFAULT, 642, timeout_search);
+ this.search_timeout = GLib.Timeout.add_full (Priority.DEFAULT, 642, this.timeout_search);
}
private bool timeout_search () {
Modified: xfmpc/trunk/src/extended-interface.vala
===================================================================
--- xfmpc/trunk/src/extended-interface.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/extended-interface.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -27,10 +27,10 @@
private unowned Xfmpc.Preferences preferences;
private static Xfce.ArrowButton context_button;
- private ListStore list_store;
- private ComboBox combobox;
- private Notebook notebook;
- private Menu context_menu;
+ private Gtk.ListStore list_store;
+ private Gtk.ComboBox combobox;
+ private Gtk.Notebook notebook;
+ private Gtk.Menu context_menu;
private enum Columns {
COLUMN_STRING,
@@ -44,54 +44,54 @@
}
construct {
- mpdclient = Xfmpc.Mpdclient.get ();
- preferences = Xfmpc.Preferences.get ();
+ this.mpdclient = Xfmpc.Mpdclient.get ();
+ this.preferences = Xfmpc.Preferences.get ();
- var hbox = new HBox (false, 2);
+ var hbox = new Gtk.HBox (false, 2);
pack_start (hbox, false, false, 2);
- var button = new Button ();
+ var button = new Gtk.Button ();
button.set_tooltip_text (_("Clear Playlist"));
button.clicked += cb_playlist_clear;
hbox.pack_start (button, false, false, 0);
- var image = new Image.from_stock (STOCK_NEW, IconSize.MENU);
+ var image = new Gtk.Image.from_stock (Gtk.STOCK_NEW, Gtk.IconSize.MENU);
button.set_image (image);
- button = new Button ();
+ button = new Gtk.Button ();
button.set_tooltip_text (_("Refresh Database"));
button.clicked += cb_database_refresh;
hbox.pack_start (button, false, false, 0);
- image = new Image.from_stock (STOCK_REFRESH, IconSize.MENU);
+ image = new Gtk.Image.from_stock (Gtk.STOCK_REFRESH, Gtk.IconSize.MENU);
button.set_image (image);
- context_button = new Xfce.ArrowButton (ArrowType.DOWN);
- ((Widget) context_button).set_tooltip_text (_("Context Menu"));
- ((Button) context_button).pressed += popup_context_menu;
- ((Button) context_button).clicked += cb_context_menu_clicked;
- hbox.pack_start (((Widget) context_button), false, false, 0);
+ this.context_button = new Xfce.ArrowButton (Gtk.ArrowType.DOWN);
+ ((Widget) this.context_button).set_tooltip_text (_("Context Menu"));
+ ((Button) this.context_button).pressed += popup_context_menu;
+ ((Button) this.context_button).clicked += cb_context_menu_clicked;
+ hbox.pack_start (((Widget) this.context_button), false, false, 0);
- list_store = new ListStore (Columns.N_COLUMNS,
- typeof (string),
- typeof (void *));
+ this.list_store = new Gtk.ListStore (Columns.N_COLUMNS,
+ typeof (string),
+ typeof (void *));
- combobox = new ComboBox.with_model (list_store);
+ this.combobox = new Gtk.ComboBox.with_model (this.list_store);
hbox.pack_start (combobox, true, true, 0);
- combobox.changed += cb_interface_changed;
+ this.combobox.changed += cb_interface_changed;
- var cell = new CellRendererText ();
- combobox.pack_start (cell, true);
- combobox.set_attributes (cell, "text", Columns.COLUMN_STRING, null);
+ var cell = new Gtk.CellRendererText ();
+ this.combobox.pack_start (cell, true);
+ this.combobox.set_attributes (cell, "text", Columns.COLUMN_STRING, null);
- notebook = new Notebook ();
- notebook.set_show_tabs (false);
- pack_start (notebook, true, true, 0);
+ this.notebook = new Gtk.Notebook ();
+ this.notebook.set_show_tabs (false);
+ pack_start (this.notebook, true, true, 0);
- Widget playlist = (Widget) new Playlist ();
+ Gtk.Widget playlist = (Gtk.Widget) new Xfmpc.Playlist ();
append_child (playlist, _("Current Playlist"));
- Widget dbbrowser = (Widget) new Dbbrowser ();
+ Gtk.Widget dbbrowser = (Gtk.Widget) new Xfmpc.Dbbrowser ();
append_child (dbbrowser, _("Browse database"));
playlist.set_data ("XfmpcDbbrowser", dbbrowser);
@@ -99,44 +99,44 @@
}
public void set_active (ExtendedInterfaceWidget active_widget) {
- combobox.set_active (active_widget);
+ this.combobox.set_active (active_widget);
}
- private void append_child (Widget child, string title) {
- TreeIter iter;
+ private void append_child (Gtk.Widget child, string title) {
+ Gtk.TreeIter iter;
- list_store.append (out iter);
- list_store.set (iter,
- Columns.COLUMN_STRING, title,
- Columns.COLUMN_POINTER, child,
- -1);
+ this.list_store.append (out iter);
+ this.list_store.set (iter,
+ Columns.COLUMN_STRING, title,
+ Columns.COLUMN_POINTER, child,
+ -1);
- if (combobox.get_active () == -1)
- combobox.set_active (0);
+ if (this.combobox.get_active () == -1)
+ this.combobox.set_active (0);
- notebook.append_page (child, null);
- notebook.set_tab_label_packing (child, true, true, PackType.START);
+ this.notebook.append_page (child, null);
+ this.notebook.set_tab_label_packing (child, true, true, Gtk.PackType.START);
}
private void popup_context_menu () {
- if (context_menu == null)
- context_menu_new ((Widget) context_button);
+ if (this.context_menu == null)
+ this.context_menu_new ((Gtk.Widget) this.context_button);
- context_menu.popup (null, null,
- (MenuPositionFunc) position_context_menu,
+ this.context_menu.popup (null, null,
+ (Gtk.MenuPositionFunc) this.position_context_menu,
0, get_current_event_time ());
}
- private static void position_context_menu (Menu menu, int x, int y, bool push_in) {
- Requisition menu_req;
+ private static void position_context_menu (Gtk.Menu menu, int x, int y, bool push_in) {
+ Gtk.Requisition menu_req;
int root_x;
int root_y;
menu.size_request (out menu_req);
- (((Widget) context_button).window).get_origin (out root_x, out root_y);
+ (((Gtk.Widget) context_button).window).get_origin (out root_x, out root_y);
- x = root_x + (((Widget) context_button).allocation).x;
- y = root_y + (((Widget) context_button).allocation).y;
+ x = root_x + (((Gtk.Widget) context_button).allocation).x;
+ y = root_y + (((Gtk.Widget) context_button).allocation).y;
if (y > Gdk.Screen.height () - menu_req.height)
y = Gdk.Screen.height () - menu_req.height;
@@ -146,34 +146,34 @@
push_in = false;
}
- private void context_menu_new (Widget attach_widget) {
- context_menu = new Menu ();
- context_menu.set_screen (attach_widget.get_screen ());
- context_menu.attach_to_widget (attach_widget, (MenuDetachFunc) menu_detach);
- context_menu.deactivate += cb_context_menu_deactivate;
+ private void context_menu_new (Gtk.Widget attach_widget) {
+ this.context_menu = new Gtk.Menu ();
+ this.context_menu.set_screen (attach_widget.get_screen ());
+ this.context_menu.attach_to_widget (attach_widget, (Gtk.MenuDetachFunc) menu_detach);
+ this.context_menu.deactivate += cb_context_menu_deactivate;
- var mi = new CheckMenuItem.with_label (_("Repeat"));
- mi.set_active (mpdclient.get_repeat ());
+ var mi = new Gtk.CheckMenuItem.with_label (_("Repeat"));
+ mi.set_active (this.mpdclient.get_repeat ());
mi.activate += cb_repeat_switch;
- context_menu.append (mi);
+ this.context_menu.append (mi);
- mi = new CheckMenuItem.with_label (_("Random"));
- mi.set_active (mpdclient.get_random ());
+ mi = new Gtk.CheckMenuItem.with_label (_("Random"));
+ mi.set_active (this.mpdclient.get_random ());
mi.activate += cb_random_switch;
- context_menu.append (mi);
+ this.context_menu.append (mi);
- var separator = new SeparatorMenuItem ();
- context_menu.append (separator);
+ var separator = new Gtk.SeparatorMenuItem ();
+ this.context_menu.append (separator);
- var imi = new ImageMenuItem.from_stock (STOCK_PREFERENCES, null);
+ var imi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_PREFERENCES, null);
imi.activate += cb_preferences;
- context_menu.append (imi);
+ this.context_menu.append (imi);
- imi = new ImageMenuItem.from_stock (STOCK_ABOUT, null);
+ imi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ABOUT, null);
imi.activate += cb_about;
- context_menu.append (imi);
+ this.context_menu.append (imi);
- context_menu.show_all ();
+ this.context_menu.show_all ();
}
private void menu_detach (Widget attach_widget, Menu menu) {
@@ -184,48 +184,48 @@
*/
private void cb_playlist_clear () {
- mpdclient.playlist_clear ();
+ this.mpdclient.playlist_clear ();
}
private void cb_database_refresh () {
- mpdclient.database_refresh ();
+ this.mpdclient.database_refresh ();
}
private void cb_interface_changed () {
void *child = null;
- TreeIter iter;
+ Gtk.TreeIter iter;
int i = 0;
- if (combobox.get_active_iter (out iter) == false)
+ if (this.combobox.get_active_iter (out iter) == false)
return;
- ((TreeModel) list_store).get (iter, Columns.COLUMN_POINTER, out child, -1);
+ ((Gtk.TreeModel) this.list_store).get (iter, Columns.COLUMN_POINTER, out child, -1);
- i = notebook.page_num ((Widget) child);
- notebook.set_current_page (i);
+ i = this.notebook.page_num ((Gtk.Widget) child);
+ this.notebook.set_current_page (i);
}
private void cb_context_menu_clicked () {
- if (!((ToggleButton) context_button).get_active ())
+ if (!((Gtk.ToggleButton) this.context_button).get_active ())
return;
popup_context_menu ();
}
private void cb_context_menu_deactivate () {
- ((ToggleButton) context_button).set_active (false);
+ ((Gtk.ToggleButton) this.context_button).set_active (false);
}
private void cb_repeat_switch () {
- mpdclient.set_repeat (!mpdclient.get_repeat ());
+ this.mpdclient.set_repeat (!this.mpdclient.get_repeat ());
}
private void cb_random_switch () {
- mpdclient.set_random (!mpdclient.get_random ());
+ this.mpdclient.set_random (!this.mpdclient.get_random ());
}
private void cb_preferences () {
- var dialog = new PreferencesDialog ();
+ var dialog = new Xfmpc.PreferencesDialog ();
dialog.show ();
}
@@ -235,17 +235,17 @@
"Vincent Legout <vincent at xfce.org>"};
string[] documenters = { null };
- show_about_dialog (((Window) ((Widget) this).get_toplevel ()),
- "artists", artists,
- "authors", authors,
- "comments", _("MPD client written in GTK+ for Xfce"),
- "copyright", "Copyright \302\251 2008-2009 Mike Massonnet, Vincent Legout",
- "documenters", documenters,
- "license", Xfce.get_license_text (Xfce.LicenseTextType.GPL),
- "translator-credits", _("translator-credits"),
- "version", Config.PACKAGE_VERSION,
- "website", "http://goodies.xfce.org/projects/applications/xfmpc",
- null);
+ Gtk.show_about_dialog (((Gtk.Window) ((Gtk.Widget) this).get_toplevel ()),
+ "artists", artists,
+ "authors", authors,
+ "comments", _("MPD client written in GTK+ for Xfce"),
+ "copyright", "Copyright \302\251 2008-2009 Mike Massonnet, Vincent Legout",
+ "documenters", documenters,
+ "license", Xfce.get_license_text (Xfce.LicenseTextType.GPL),
+ "translator-credits", _("translator-credits"),
+ "version", Config.PACKAGE_VERSION,
+ "website", "http://goodies.xfce.org/projects/applications/xfmpc",
+ null);
}
}
}
Modified: xfmpc/trunk/src/interface.vala
===================================================================
--- xfmpc/trunk/src/interface.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/interface.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -26,45 +26,45 @@
private unowned Xfmpc.Mpdclient mpdclient;
private unowned Xfmpc.Preferences preferences;
- private Button button_prev;
- private Button button_pp;
- private Button button_next;
- private VolumeButton button_volume;
- private ProgressBar progress_bar;
- private Label title;
- private Label subtitle;
+ private Gtk.Button button_prev;
+ private Gtk.Button button_pp;
+ private Gtk.Button button_next;
+ private Gtk.VolumeButton button_volume;
+ private Gtk.ProgressBar progress_bar;
+ private Gtk.Label title;
+ private Gtk.Label subtitle;
private bool refresh_title;
construct {
- mpdclient = Xfmpc.Mpdclient.get ();
- preferences = Xfmpc.Preferences.get ();
+ this.mpdclient = Xfmpc.Mpdclient.get ();
+ this.preferences = Xfmpc.Preferences.get ();
set_border_width (4);
- var image = new Image.from_stock (STOCK_MEDIA_PREVIOUS, IconSize.BUTTON);
- button_prev = new Button ();
- button_prev.set_relief (ReliefStyle.NONE);
- button_prev.add (image);
+ var image = new Gtk.Image.from_stock (Gtk.STOCK_MEDIA_PREVIOUS, Gtk.IconSize.BUTTON);
+ this.button_prev = new Gtk.Button ();
+ this.button_prev.set_relief (Gtk.ReliefStyle.NONE);
+ this.button_prev.add (image);
- image = new Image.from_stock (STOCK_MEDIA_PLAY, IconSize.BUTTON);
- button_pp = new Button ();
- button_pp.set_relief (ReliefStyle.NONE);
- button_pp.add (image);
+ image = new Gtk.Image.from_stock (Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON);
+ this.button_pp = new Gtk.Button ();
+ this.button_pp.set_relief (Gtk.ReliefStyle.NONE);
+ this.button_pp.add (image);
- image = new Image.from_stock (STOCK_MEDIA_NEXT, IconSize.BUTTON);
- button_next = new Button ();
- button_next.set_relief (ReliefStyle.NONE);
- button_next.add (image);
+ image = new Gtk.Image.from_stock (Gtk.STOCK_MEDIA_NEXT, Gtk.IconSize.BUTTON);
+ this.button_next = new Gtk.Button ();
+ this.button_next.set_relief (Gtk.ReliefStyle.NONE);
+ this.button_next.add (image);
- button_volume = new VolumeButton ();
- button_volume.set_relief (ReliefStyle.NONE);
+ this.button_volume = new Gtk.VolumeButton ();
+ this.button_volume.set_relief (Gtk.ReliefStyle.NONE);
var adjustment = button_volume.get_adjustment ();
adjustment.upper *= 100;
adjustment.step_increment *= 100;
adjustment.page_increment *= 100;
- var progress_box = new EventBox ();
- progress_bar = new ProgressBar ();
+ var progress_box = new Gtk.EventBox ();
+ progress_bar = new Gtk.ProgressBar ();
progress_bar.set_text ("0:00 / 0:00");
progress_bar.set_fraction (1.0);
progress_box.add (progress_bar);
@@ -81,7 +81,7 @@
attr.end_index = -1;
attrs.insert (attr);
- title = new Label (_("Not connected"));
+ title = new Gtk.Label (_("Not connected"));
title.set_attributes (attrs);
title.set_selectable (true);
title.set_ellipsize (Pango.EllipsizeMode.END);
@@ -94,39 +94,39 @@
attr.end_index = -1;
attrs.insert (attr);
- subtitle = new Label (Config.PACKAGE_STRING);
- subtitle.set_attributes (attrs);
- subtitle.set_selectable (true);
- subtitle.set_ellipsize (Pango.EllipsizeMode.END);
- subtitle.set_alignment (0, (float) 0.5);
+ this.subtitle = new Gtk.Label (Config.PACKAGE_STRING);
+ this.subtitle.set_attributes (attrs);
+ this.subtitle.set_selectable (true);
+ this.subtitle.set_ellipsize (Pango.EllipsizeMode.END);
+ this.subtitle.set_alignment (0, (float) 0.5);
/* === Containers === */
- var box = new HBox (false, 0);
+ var box = new Gtk.HBox (false, 0);
pack_start (box, false, false, 0);
- box.pack_start (button_prev, false, false, 0);
- box.pack_start (button_pp, false, false, 0);
- box.pack_start (button_next, false, false, 0);
+ box.pack_start (this.button_prev, false, false, 0);
+ box.pack_start (this.button_pp, false, false, 0);
+ box.pack_start (this.button_next, false, false, 0);
box.pack_start (progress_box, true, true, 4);
- box.pack_start (button_volume, false, false, 0);
+ box.pack_start (this.button_volume, false, false, 0);
- var vbox = new VBox (false, 0);
+ var vbox = new Gtk.VBox (false, 0);
pack_start (vbox, false, true, 0);
- vbox.add (title);
- vbox.add (subtitle);
+ vbox.add (this.title);
+ vbox.add (this.subtitle);
/* === Signals === */
- button_prev.clicked += cb_mpdclient_previous;
- button_pp.clicked += pp_clicked;
- button_next.clicked += cb_mpdclient_next;
- button_volume.value_changed += volume_changed;
+ this.button_prev.clicked += cb_mpdclient_previous;
+ this.button_pp.clicked += pp_clicked;
+ this.button_next.clicked += cb_mpdclient_next;
+ this.button_volume.value_changed += volume_changed;
progress_box.button_release_event += cb_progress_box_release_event;
- mpdclient.connected += reconnect;
- mpdclient.song_changed += cb_song_changed;
- mpdclient.pp_changed += cb_pp_changed;
- mpdclient.time_changed += cb_time_changed;
- mpdclient.volume_changed += cb_volume_changed;
- mpdclient.stopped += cb_stopped;
+ this.mpdclient.connected += reconnect;
+ this.mpdclient.song_changed += cb_song_changed;
+ this.mpdclient.pp_changed += cb_pp_changed;
+ this.mpdclient.time_changed += cb_time_changed;
+ this.mpdclient.volume_changed += cb_volume_changed;
+ this.mpdclient.stopped += cb_stopped;
/* === Timeout === */
Timeout.add (1000, refresh);
@@ -141,46 +141,46 @@
}
public void pp_clicked () {
- if (!mpdclient.pp ())
+ if (!this.mpdclient.pp ())
return;
- set_pp (mpdclient.is_playing ());
+ set_pp (this.mpdclient.is_playing ());
}
public void set_pp (bool play) {
- var image = (Image) button_pp.get_child ();
+ var image = (Gtk.Image) this.button_pp.get_child ();
if (play == true)
- image.set_from_stock (STOCK_MEDIA_PAUSE, IconSize.BUTTON);
+ image.set_from_stock (Gtk.STOCK_MEDIA_PAUSE, Gtk.IconSize.BUTTON);
else
- image.set_from_stock (STOCK_MEDIA_PLAY, IconSize.BUTTON);
+ image.set_from_stock (Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON);
}
private bool cb_progress_box_release_event (Gdk.EventButton event) {
if (event.type != Gdk.EventType.BUTTON_RELEASE || event.button != 1)
return false;
- int time_total = mpdclient.get_total_time ();
+ int time_total = this.mpdclient.get_total_time ();
if (time_total < 0)
return false;
- double time = event.x / progress_bar.allocation.width;
+ double time = event.x / this.progress_bar.allocation.width;
time *= time_total;
- mpdclient.set_song_time ((int) time);
+ this.mpdclient.set_song_time ((int) time);
return true;
}
public void volume_changed (double value) {
- mpdclient.set_volume ((char) value);
+ this.mpdclient.set_volume ((char) value);
}
public void set_volume (int volume) {
- button_volume.set_value (volume);
+ this.button_volume.set_value (volume);
}
public void popup_volume () {
- Signal.emit_by_name (button_volume, "popup", null);
+ GLib.Signal.emit_by_name (this.button_volume, "popup", null);
}
public void set_time (int time, int time_total) {
@@ -193,59 +193,60 @@
min_total = time_total / 60;
sec_total = time_total % 60;
- StringBuilder text = new StringBuilder ();
+ GLib.StringBuilder text = new GLib.StringBuilder ();
text.append_printf ("%d:%02d / %d:%02d", min, sec, min_total, sec_total);
- progress_bar.set_text (text.str);
+ this.progress_bar.set_text (text.str);
if (time_total > 0)
fraction = (float)time / (float)time_total;
- progress_bar.set_fraction ((fraction <= 1.0) ? fraction : 1.0);
+ this.progress_bar.set_fraction ((fraction <= 1.0) ? fraction : 1.0);
}
private bool refresh () {
- if (mpdclient.connect () == false) {
+ if (this.mpdclient.connect () == false) {
warning ("Failed to connect to MPD");
- mpdclient.disconnect ();
+ this.mpdclient.disconnect ();
+
set_pp (false);
set_time (0, 0);
set_volume (0);
set_title (_("Not connected"));
set_subtitle (Config.PACKAGE_STRING);
- Timeout.add (15000, (SourceFunc) reconnect);
+ GLib.Timeout.add (15000, (GLib.SourceFunc) reconnect);
return false;
}
- mpdclient.update_status ();
+ this.mpdclient.update_status ();
return true;
}
private void reconnect () {
- if (mpdclient.connect () == false)
+ if (this.mpdclient.connect () == false)
return;
/* Refresh title/subtitle (bug #4975) */
- refresh_title = true;
- if (mpdclient.is_playing ())
+ this.refresh_title = true;
+ if (this.mpdclient.is_playing ())
cb_song_changed ();
else
cb_stopped ();
/* Return FALSE to kill the reconnection timeout and start a refresh timeout */
- Timeout.add (1000, refresh);
+ GLib.Timeout.add (1000, refresh);
}
private void cb_song_changed () {
/* title */
- set_title (mpdclient.get_title ());
+ set_title (this.mpdclient.get_title ());
/* subtitle "by \"artist\" from \"album\" (year)" */
- StringBuilder text = new StringBuilder ();
+ GLib.StringBuilder text = new GLib.StringBuilder ();
text.append_printf (_("by \"%s\" from \"%s\" (%s)"),
- mpdclient.get_artist (),
- mpdclient.get_album (),
- mpdclient.get_date ());
+ this.mpdclient.get_artist (),
+ this.mpdclient.get_album (),
+ this.mpdclient.get_date ());
/* text = xfmpc_interface_get_subtitle (interface); to avoid "n/a" values, so far I don't care */
set_subtitle (text.str);
@@ -254,9 +255,9 @@
private void cb_pp_changed (bool is_playing) {
set_pp (is_playing);
- if (refresh_title) {
+ if (this.refresh_title) {
cb_song_changed ();
- refresh_title = false;
+ this.refresh_title = false;
}
}
@@ -274,15 +275,15 @@
set_title (_("Stopped"));
set_subtitle (Config.PACKAGE_STRING);
- refresh_title = true;
+ this.refresh_title = true;
}
private void cb_mpdclient_previous () {
- mpdclient.previous ();
+ this.mpdclient.previous ();
}
private void cb_mpdclient_next () {
- mpdclient.next ();
+ this.mpdclient.next ();
}
}
}
Modified: xfmpc/trunk/src/main-window.c
===================================================================
--- xfmpc/trunk/src/main-window.c 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/main-window.c 2009-06-16 18:51:39 UTC (rev 7599)
@@ -109,11 +109,10 @@
static void _xfmpc_main_window_action_next_gtk_action_callback (GtkAction* action, gpointer self);
static void xfmpc_main_window_action_volume (XfmpcMainWindow* self);
static void _xfmpc_main_window_action_volume_gtk_action_callback (GtkAction* action, gpointer self);
-#define XFMPC_MAIN_WINDOW_main_ui "<ui><accelerator action=\"quit\" /><accelerator action=\"previous\" /><accelerator action=\"pp\" /><accelerator action=\"stop\" /><accelerator action=\"next\" /><accelerator action=\"volume\" /></ui>"
-#define XFMPC_MAIN_WINDOW_main_ui_length (gint) 187u
+#define XFMPC_MAIN_WINDOW_ui_string "\n<ui>\n <accelerator action=\"quit\" />\n <accelerator action=\"previous\" />\n <accelerator action=\"pp\" />\n <accelerator action=\"stop\" />\n <accelerator action=\"next\" />\n <accelerator action=\"volume\" />\n</ui>\n"
static gboolean xfmpc_main_window_cb_window_state_event (XfmpcMainWindow* self, const GdkEventWindowState* event);
static void xfmpc_main_window_close_window (XfmpcMainWindow* self);
-static gboolean xfmpc_main_window_cb_window_closed (XfmpcMainWindow* self, const GdkEvent* event);
+static gboolean xfmpc_main_window_cb_window_closed (XfmpcMainWindow* self, GdkEvent* event);
GType xfmpc_interface_get_type (void);
void xfmpc_interface_pp_clicked (XfmpcInterface* self);
void xfmpc_interface_popup_volume (XfmpcInterface* self);
@@ -127,7 +126,7 @@
XfmpcMainWindow* xfmpc_main_window_new (void);
XfmpcMainWindow* xfmpc_main_window_construct (GType object_type);
XfmpcMainWindow* xfmpc_main_window_new (void);
-static gboolean _xfmpc_main_window_cb_window_closed_gtk_widget_delete_event (XfmpcMainWindow* _sender, const GdkEvent* event, gpointer self);
+static gboolean _xfmpc_main_window_cb_window_closed_gtk_widget_delete_event (XfmpcMainWindow* _sender, GdkEvent* event, gpointer self);
static gboolean _xfmpc_main_window_cb_window_state_event_gtk_widget_window_state_event (XfmpcMainWindow* _sender, const GdkEventWindowState* event, gpointer self);
XfmpcInterface* xfmpc_interface_new (void);
XfmpcInterface* xfmpc_interface_construct (GType object_type);
@@ -211,8 +210,9 @@
}
-static gboolean xfmpc_main_window_cb_window_closed (XfmpcMainWindow* self, const GdkEvent* event) {
+static gboolean xfmpc_main_window_cb_window_closed (XfmpcMainWindow* self, GdkEvent* event) {
g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (event != NULL, FALSE);
xfmpc_main_window_close_window (self);
return FALSE;
}
@@ -379,7 +379,7 @@
}
-static gboolean _xfmpc_main_window_cb_window_closed_gtk_widget_delete_event (XfmpcMainWindow* _sender, const GdkEvent* event, gpointer self) {
+static gboolean _xfmpc_main_window_cb_window_closed_gtk_widget_delete_event (XfmpcMainWindow* _sender, GdkEvent* event, gpointer self) {
return xfmpc_main_window_cb_window_closed (self, event);
}
@@ -411,6 +411,7 @@
self = XFMPC_MAIN_WINDOW (obj);
_inner_error_ = NULL;
{
+ XfmpcPreferences* preferences1;
GtkVBox* _tmp0_;
gboolean _tmp1_;
gboolean _tmp2_;
@@ -423,6 +424,7 @@
GtkAccelGroup* accel_group;
self->priv->mpdclient = xfmpc_mpdclient_get ();
self->priv->preferences = xfmpc_preferences_get ();
+ preferences1 = xfmpc_preferences_get ();
/* Window */
gtk_window_set_default_icon_name ("xfmpc");
gtk_window_set_icon_name ((GtkWindow*) self, "stock_volume");
@@ -474,7 +476,7 @@
gtk_action_group_add_toggle_actions (self->priv->action_group, XFMPC_MAIN_WINDOW_toggle_action_entries, G_N_ELEMENTS (XFMPC_MAIN_WINDOW_toggle_action_entries), self);
gtk_ui_manager_insert_action_group (self->priv->ui_manager, self->priv->action_group, 0);
{
- gtk_ui_manager_add_ui_from_string (self->priv->ui_manager, XFMPC_MAIN_WINDOW_main_ui, (gssize) XFMPC_MAIN_WINDOW_main_ui_length, &_inner_error_);
+ gtk_ui_manager_add_ui_from_string (self->priv->ui_manager, XFMPC_MAIN_WINDOW_ui_string, (gssize) (-1), &_inner_error_);
if (_inner_error_ != NULL) {
goto __catch0_g_error;
goto __finally0;
Modified: xfmpc/trunk/src/main-window.vala
===================================================================
--- xfmpc/trunk/src/main-window.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/main-window.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -26,16 +26,16 @@
private unowned Xfmpc.Mpdclient mpdclient;
private unowned Xfmpc.Preferences preferences;
- private VBox vbox;
- private ActionGroup action_group;
- private Widget statusbar;
- private UIManager ui_manager;
+ private Gtk.VBox vbox;
+ private Gtk.ActionGroup action_group;
+ private Gtk.Widget statusbar;
+ private Gtk.UIManager ui_manager;
- private const ToggleActionEntry[] toggle_action_entries = {
+ private const Gtk.ToggleActionEntry[] toggle_action_entries = {
{ "view-statusbar", null, "", null, null, action_statusbar, false }
};
- private const ActionEntry[] action_entries = {
+ private const Gtk.ActionEntry[] action_entries = {
{ "quit", null, "", "<control>q", null, action_close },
{ "previous", null, "", "<control>b", null, action_previous },
{ "pp", null, "", "<control>p", null, action_pp },
@@ -44,12 +44,22 @@
{ "volume", null, "", "<control>v", null, action_volume }
};
- private const string main_ui = "<ui><accelerator action=\"quit\" /><accelerator action=\"previous\" /><accelerator action=\"pp\" /><accelerator action=\"stop\" /><accelerator action=\"next\" /><accelerator action=\"volume\" /></ui>";
- private const int main_ui_length = 187u;
+ private const string ui_string =
+"""
+<ui>
+ <accelerator action="quit" />
+ <accelerator action="previous" />
+ <accelerator action="pp" />
+ <accelerator action="stop" />
+ <accelerator action="next" />
+ <accelerator action="volume" />
+</ui>
+""";
construct {
mpdclient = Xfmpc.Mpdclient.get ();
preferences = Xfmpc.Preferences.get ();
+ unowned Preferences preferences1 = Xfmpc.Preferences.get ();
/* Window */
set_default_icon_name ("xfmpc");
@@ -59,53 +69,53 @@
this.delete_event += cb_window_closed;
this.window_state_event += cb_window_state_event;
- vbox = new VBox (false, 0);
+ this.vbox = new Gtk.VBox (false, 0);
add (vbox);
- if (preferences.last_window_posx != -1 && preferences.last_window_posy != -1)
- move (preferences.last_window_posx, preferences.last_window_posy);
- if (preferences.last_window_width != -1 && preferences.last_window_height != -1)
- set_default_size (preferences.last_window_width, preferences.last_window_height);
- if (preferences.last_window_state_sticky == true)
+ if (this.preferences.last_window_posx != -1 && this.preferences.last_window_posy != -1)
+ move (this.preferences.last_window_posx, this.preferences.last_window_posy);
+ if (this.preferences.last_window_width != -1 && this.preferences.last_window_height != -1)
+ set_default_size (this.preferences.last_window_width, this.preferences.last_window_height);
+ if (this.preferences.last_window_state_sticky == true)
stick ();
/* Interface */
- var interface = new Interface ();
+ var interface = new Xfmpc.Interface ();
set_data ("XfmpcInterface", interface);
- vbox.pack_start (interface, false, false, 4);
+ this.vbox.pack_start (interface, false, false, 4);
/* Separator */
- var separator = new HSeparator ();
- vbox.pack_start (separator, false, false, 0);
+ var separator = new Gtk.HSeparator ();
+ this.vbox.pack_start (separator, false, false, 0);
/* ExtendedInterface */
- var extended_interface = new ExtendedInterface ();
- vbox.pack_start (extended_interface, true, true, 0);
+ var extended_interface = new Xfmpc.ExtendedInterface ();
+ this.vbox.pack_start (extended_interface, true, true, 0);
/* Accelerators */
- ui_manager = new UIManager ();
+ this.ui_manager = new Gtk.UIManager ();
/* Action group */
- action_group = new ActionGroup ("XfmpcMainWindow");
- action_group.add_actions (action_entries, this);
- action_group.add_toggle_actions (toggle_action_entries, this);
- ui_manager.insert_action_group (action_group, 0);
+ this.action_group = new Gtk.ActionGroup ("XfmpcMainWindow");
+ this.action_group.add_actions (this.action_entries, this);
+ this.action_group.add_toggle_actions (this.toggle_action_entries, this);
+ this.ui_manager.insert_action_group (this.action_group, 0);
try {
- ui_manager.add_ui_from_string (main_ui, main_ui_length);
+ this.ui_manager.add_ui_from_string (this.ui_string, -1);
} catch (Error e) {
warning (e.message);
}
/* Accel group */
- var accel_group = ui_manager.get_accel_group ();
+ var accel_group = this.ui_manager.get_accel_group ();
add_accel_group (accel_group);
/* show-statusbar action */
- ((ToggleAction )(action_group.get_action ("view-statusbar"))).set_active (preferences.show_statusbar);
+ ((Gtk.ToggleAction )(this.action_group.get_action ("view-statusbar"))).set_active (this.preferences.show_statusbar);
/* === Signals === */
- mpdclient.playlist_changed += cb_playlist_changed;
- preferences.notify["show-statusbar"] += cb_show_statusbar_changed;
+ this.mpdclient.playlist_changed += cb_playlist_changed;
+ this.preferences.notify["show-statusbar"] += cb_show_statusbar_changed;
}
private bool cb_window_state_event (Gdk.EventWindowState event) {
@@ -124,7 +134,7 @@
else
sticky = true;
- preferences.last_window_state_sticky = sticky;
+ this.preferences.last_window_state_sticky = sticky;
}
return false;
@@ -147,69 +157,69 @@
get_position (out posx, out posy);
get_size (out width, out height);
- preferences.last_window_posx = posx;
- preferences.last_window_posy = posy;
- preferences.last_window_width = width;
- preferences.last_window_height = height;
+ this.preferences.last_window_posx = posx;
+ this.preferences.last_window_posy = posy;
+ this.preferences.last_window_width = width;
+ this.preferences.last_window_height = height;
main_quit ();
}
private void action_previous () {
- mpdclient.previous ();
+ this.mpdclient.previous ();
}
private void action_pp () {
- Interface interface = (Interface) get_data ("XfmpcInterface");
+ Xfmpc.Interface interface = (Xfmpc.Interface) get_data ("XfmpcInterface");
interface.pp_clicked ();
}
private void action_stop () {
- mpdclient.stop ();
+ this.mpdclient.stop ();
}
private void action_next () {
- mpdclient.next ();
+ this.mpdclient.next ();
}
private void action_volume () {
- Interface interface = (Interface) get_data ("XfmpcInterface");
+ Xfmpc.Interface interface = (Xfmpc.Interface) get_data ("XfmpcInterface");
interface.popup_volume ();
}
private void action_statusbar (Action action) {
- bool active = ((ToggleAction) action).get_active ();
+ bool active = ((Gtk.ToggleAction) action).get_active ();
- if (!active && statusbar != null) {
- statusbar.destroy ();
- statusbar = null;
+ if (!active && this.statusbar != null) {
+ this.statusbar.destroy ();
+ this.statusbar = null;
}
- else if (active && statusbar == null) {
- statusbar = new Statusbar ();
- statusbar.show ();
- vbox.pack_start (statusbar, false, false, 0);
+ else if (active && this.statusbar == null) {
+ this.statusbar = new Statusbar ();
+ this.statusbar.show ();
+ this.vbox.pack_start (this.statusbar, false, false, 0);
}
}
private void update_statusbar () {
int seconds, length;
- if (statusbar == null)
+ if (this.statusbar == null)
return;
- if (!mpdclient.is_connected ())
+ if (!this.mpdclient.is_connected ())
return;
- length = mpdclient.playlist_get_length ();
- seconds = mpdclient.playlist_get_total_time ();
+ length = this.mpdclient.playlist_get_length ();
+ seconds = this.mpdclient.playlist_get_total_time ();
- StringBuilder text = new StringBuilder ();
+ GLib.StringBuilder text = new GLib.StringBuilder ();
if (seconds / 3600 > 0)
text.append_printf (_("%d songs, %d hours and %d minutes"), length, seconds / 3600, (seconds / 60) % 60);
else
text.append_printf (_("%d songs, %d minutes"), length, (seconds / 60) % 60);
- ((Statusbar) statusbar).text = text.str;
+ ((Xfmpc.Statusbar) this.statusbar).text = text.str;
}
private void cb_playlist_changed () {
@@ -217,10 +227,10 @@
}
private void cb_show_statusbar_changed (ParamSpec pspec) {
- var action = action_group.get_action ("view-statusbar");
- bool active = preferences.show_statusbar;
+ var action = this.action_group.get_action ("view-statusbar");
+ bool active = this.preferences.show_statusbar;
- ((ToggleAction) action).set_active (active);
+ ((Gtk.ToggleAction) action).set_active (active);
update_statusbar ();
}
}
Modified: xfmpc/trunk/src/main.c
===================================================================
--- xfmpc/trunk/src/main.c 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/main.c 2009-06-16 18:51:39 UTC (rev 7599)
@@ -34,7 +34,6 @@
#include "xfmpc.h"
-
static void
transform_string_to_int (const GValue *src,
GValue *dst)
@@ -82,7 +81,7 @@
g_value_register_transform_func (G_TYPE_STRING, G_TYPE_BOOLEAN, transform_string_to_boolean);
g_value_register_transform_func (G_TYPE_STRING, G_TYPE_ENUM, transform_string_to_enum);
- GtkWidget *window = xfmpc_main_window_new ();
+ GtkWidget *window = (GtkWidget *)xfmpc_main_window_new ();
gtk_widget_show_all (window);
gtk_main ();
Added: xfmpc/trunk/src/mpdclient.vapi
===================================================================
--- xfmpc/trunk/src/mpdclient.vapi (rev 0)
+++ xfmpc/trunk/src/mpdclient.vapi 2009-06-16 18:51:39 UTC (rev 7599)
@@ -0,0 +1,72 @@
+/* mpdclient.vapi generated by vapigen, do not modify. */
+
+[CCode (cprefix = "Xfmpc", lower_case_cprefix = "xfmpc_")]
+namespace Xfmpc {
+ [Compact]
+ [CCode (cheader_filename = "mpdclient.h")]
+ public class Mpdclient {
+ public bool connect ();
+ public bool database_read (string dir, string *filename, string *basename, bool *is_dir);
+ public bool database_refresh ();
+ public bool database_search (string query, string *filename, string *basename);
+ public void disconnect ();
+ public static unowned Xfmpc.Mpdclient get ();
+ public unowned string get_album ();
+ public unowned string get_artist ();
+ public unowned string get_date ();
+ public int get_id ();
+ public int get_pos ();
+ public bool get_random ();
+ public bool get_repeat ();
+ public unowned Xfmpc.SongInfo get_song_info (int id);
+ public int get_time ();
+ public unowned string get_title ();
+ public int get_total_time ();
+ public uchar get_volume ();
+ public bool is_connected ();
+ public bool is_playing ();
+ public bool is_stopped ();
+ public bool next ();
+ public bool pause ();
+ public bool play ();
+ public bool playlist_clear ();
+ public int playlist_get_length ();
+ public int playlist_get_total_time ();
+ public bool playlist_has_filename (string filename, bool is_dir);
+ public bool playlist_read (int *id, int *pos, string *filename, string *song, string *length);
+ public bool pp ();
+ public bool previous ();
+ public bool queue_add (string path);
+ public bool queue_clear ();
+ public bool queue_commit ();
+ public bool queue_remove_id (int id);
+ public bool set_id (int id);
+ public bool set_random (bool random);
+ public bool set_repeat (bool repeat);
+ public bool set_song_time (uint time);
+ public bool set_volume (uchar volume);
+ public bool stop ();
+ public void update_status ();
+ public virtual signal void connected ();
+ public virtual signal void song_changed ();
+ public virtual signal void pp_changed (bool is_playing);
+ public virtual signal void time_changed (int time, int total_time);
+ public virtual signal void volume_changed (int volume);
+ public virtual signal void stopped ();
+ public virtual signal void database_changed ();
+ public virtual signal void playlist_changed ();
+ public virtual signal void repeat ();
+ public virtual signal void random ();
+ }
+ [Compact]
+ [CCode (cheader_filename = "mpdclient.h")]
+ public class SongInfo {
+ public weak string album;
+ public weak string artist;
+ public weak string date;
+ public weak string filename;
+ public weak string genre;
+ public weak string title;
+ public weak string track;
+ }
+}
Modified: xfmpc/trunk/src/playlist.vala
===================================================================
--- xfmpc/trunk/src/playlist.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/playlist.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -26,14 +26,14 @@
private unowned Xfmpc.Mpdclient mpdclient;
private unowned Xfmpc.Preferences preferences;
- private ListStore store;
- private TreeModelFilter filter;
- private TreeView treeview;
- private Menu menu;
- private static Entry filter_entry;
+ private Gtk.ListStore store;
+ private Gtk.TreeModelFilter filter;
+ private Gtk.TreeView treeview;
+ private Gtk.Menu menu;
+ private static Gtk.Entry filter_entry;
- private ImageMenuItem mi_browse;
- private ImageMenuItem mi_information;
+ private Gtk.ImageMenuItem mi_browse;
+ private Gtk.ImageMenuItem mi_information;
private int current = 0;
private bool autocenter;
@@ -49,95 +49,95 @@
}
construct {
- mpdclient = Xfmpc.Mpdclient.get ();
- preferences = Xfmpc.Preferences.get ();
+ this.mpdclient = Xfmpc.Mpdclient.get ();
+ this.preferences = Xfmpc.Preferences.get ();
- autocenter = preferences.playlist_autocenter;
+ this.autocenter = this.preferences.playlist_autocenter;
- store = new ListStore (Columns.N_COLUMNS,
- typeof (int),
- typeof (string),
- typeof (int),
- typeof (string),
- typeof (string),
- typeof (int));
+ this.store = new Gtk.ListStore (Columns.N_COLUMNS,
+ typeof (int),
+ typeof (string),
+ typeof (int),
+ typeof (string),
+ typeof (string),
+ typeof (int));
- filter = new TreeModelFilter (store, null);
- filter.set_visible_func ((TreeModelFilterVisibleFunc) visible_func_filter_tree);
+ this.filter = new Gtk.TreeModelFilter (this.store, null);
+ this.filter.set_visible_func ((Gtk.TreeModelFilterVisibleFunc) visible_func_filter_tree);
- treeview = new TreeView ();
- (treeview.get_selection ()).set_mode (SelectionMode.MULTIPLE);
- treeview.set_rubber_banding (true);
- treeview.set_enable_search (false);
- treeview.set_headers_visible (false);
- treeview.set_rules_hint (true);
- treeview.set_model (filter);
+ this.treeview = new Gtk.TreeView ();
+ (this.treeview.get_selection ()).set_mode (Gtk.SelectionMode.MULTIPLE);
+ this.treeview.set_rubber_banding (true);
+ this.treeview.set_enable_search (false);
+ this.treeview.set_headers_visible (false);
+ this.treeview.set_rules_hint (true);
+ this.treeview.set_model (this.filter);
- var cell = new CellRendererText ();
+ var cell = new Gtk.CellRendererText ();
cell.xalign = 1;
- treeview.insert_column_with_attributes (-1, "Length", cell,
- "text", Columns.COLUMN_POSITION,
- "weight", Columns.COLUMN_WEIGHT,
- null);
- cell = new CellRendererText ();
+ this.treeview.insert_column_with_attributes (-1, "Length", cell,
+ "text", Columns.COLUMN_POSITION,
+ "weight", Columns.COLUMN_WEIGHT,
+ null);
+ cell = new Gtk.CellRendererText ();
cell.ellipsize = Pango.EllipsizeMode.END;
- var column = new TreeViewColumn.with_attributes ("Song", cell,
- "text", Columns.COLUMN_SONG,
- "weight", Columns.COLUMN_WEIGHT,
- null);
+ var column = new Gtk.TreeViewColumn.with_attributes ("Song", cell,
+ "text", Columns.COLUMN_SONG,
+ "weight", Columns.COLUMN_WEIGHT,
+ null);
column.expand = true;
- treeview.append_column (column);
- cell = new CellRendererText ();
+ this.treeview.append_column (column);
+ cell = new Gtk.CellRendererText ();
cell.xalign = 1;
- treeview.insert_column_with_attributes (-1, "Length", cell,
- "text", Columns.COLUMN_LENGTH,
- "weight", Columns.COLUMN_WEIGHT,
- null);
+ this.treeview.insert_column_with_attributes (-1, "Length", cell,
+ "text", Columns.COLUMN_LENGTH,
+ "weight", Columns.COLUMN_WEIGHT,
+ null);
- var scrolled = new ScrolledWindow (new Adjustment (0, 0, 0, 0, 0, 0),
- new Adjustment (0, 0, 0, 0, 0, 0));
- scrolled.set_policy (PolicyType.AUTOMATIC, PolicyType.ALWAYS);
+ var scrolled = new Gtk.ScrolledWindow (new Gtk.Adjustment (0, 0, 0, 0, 0, 0),
+ new Gtk.Adjustment (0, 0, 0, 0, 0, 0));
+ scrolled.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS);
- menu = new Menu ();
+ this.menu = new Menu ();
- var mi = new ImageMenuItem.from_stock (STOCK_REMOVE, null);
- menu.append (mi);
+ var mi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_REMOVE, null);
+ this.menu.append (mi);
mi.activate += delete_selection;
- mi_browse = new ImageMenuItem.with_mnemonic (_("Browse"));
- var image = new Image.from_stock (STOCK_OPEN, IconSize.MENU);
- mi_browse.set_image (image);
- menu.append (mi_browse);
- mi_browse.activate += cb_browse_selection;
- mi_information = new ImageMenuItem.from_stock (STOCK_INFO, null);
- menu.append (mi_information);
- mi_information.activate += cb_info_selection;
+ this.mi_browse = new Gtk.ImageMenuItem.with_mnemonic (_("Browse"));
+ var image = new Gtk.Image.from_stock (Gtk.STOCK_OPEN, Gtk.IconSize.MENU);
+ this.mi_browse.set_image (image);
+ this.menu.append (this.mi_browse);
+ this.mi_browse.activate += cb_browse_selection;
+ this.mi_information = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_INFO, null);
+ this.menu.append (mi_information);
+ this.mi_information.activate += cb_info_selection;
- menu.show_all ();
+ this.menu.show_all ();
- filter_entry = new Entry ();
+ this.filter_entry = new Entry ();
- scrolled.add (treeview);
+ scrolled.add (this.treeview);
pack_start (scrolled, true, true, 0);
- pack_start (filter_entry, false, false, 0);
+ pack_start (this.filter_entry, false, false, 0);
/* Signals */
- mpdclient.song_changed += cb_song_changed;
- mpdclient.playlist_changed += cb_playlist_changed;
+ this.mpdclient.song_changed += cb_song_changed;
+ this.mpdclient.playlist_changed += cb_playlist_changed;
- treeview.row_activated += cb_row_activated;
- treeview.key_release_event += cb_key_released;
- treeview.button_press_event += cb_button_released;
- treeview.popup_menu += cb_popup_menu;
+ this.treeview.row_activated += cb_row_activated;
+ this.treeview.key_release_event += cb_key_released;
+ this.treeview.button_press_event += cb_button_released;
+ this.treeview.popup_menu += cb_popup_menu;
- filter_entry.activate += cb_filter_entry_activated;
- filter_entry.key_release_event += cb_filter_entry_key_released;
- filter_entry.changed += cb_filter_entry_changed;
+ this.filter_entry.activate += cb_filter_entry_activated;
+ this.filter_entry.key_release_event += cb_filter_entry_key_released;
+ this.filter_entry.changed += cb_filter_entry_changed;
- preferences.notify["song-format"] += cb_playlist_changed;
- preferences.notify["song-format-custom"] += cb_playlist_changed;
+ this.preferences.notify["song-format"] += cb_playlist_changed;
+ this.preferences.notify["song-format-custom"] += cb_playlist_changed;
}
- private static bool visible_func_filter_tree (TreeModel model, out TreeIter iter) {
+ private static bool visible_func_filter_tree (Gtk.TreeModel model, out Gtk.TreeIter iter) {
string song = "", search = "";
bool result = true;
@@ -169,45 +169,45 @@
dbbrowser = (Xfmpc.Dbbrowser) get_data ("XfmpcDbbrowser");
extended_interface = (Xfmpc.ExtendedInterface) get_data ("XfmpcExtendedInterface");
- var selection = treeview.get_selection ();
+ var selection = this.treeview.get_selection ();
if (selection.count_selected_rows () > 1)
return;
- var model = store;
+ var model = this.store;
var list = selection.get_selected_rows (out model);
if (list.length () == 0)
return;
- TreeIter iter;
+ Gtk.TreeIter iter;
var path = list.nth_data (0);
- if (store.get_iter (out iter, path)) {
+ if (this.store.get_iter (out iter, path)) {
string filename = "", dir;
store.get (iter, Columns.COLUMN_FILENAME, out filename, -1);
- dir = Path.get_dirname (filename);
+ dir = GLib.Path.get_dirname (filename);
dbbrowser.set_wdir (dir);
dbbrowser.reload ();
- extended_interface.set_active (ExtendedInterface.ExtendedInterfaceWidget.DBBROWSER);
+ extended_interface.set_active (Xfmpc.ExtendedInterface.ExtendedInterfaceWidget.DBBROWSER);
}
}
private void cb_info_selection () {
- TreeIter iter;
+ Gtk.TreeIter iter;
int id = 0;
- var selection = treeview.get_selection ();
+ var selection = this.treeview.get_selection ();
if (selection.count_selected_rows () > 1)
return;
- var model = store;
+ var model = this.store;
var list = selection.get_selected_rows (out model);
if (list.length () == 0)
return;
var path = list.nth_data (0);
- if (store.get_iter (out iter, path)) {
- store.get (iter, Columns.COLUMN_ID, out id, -1);
- var dialog = new SongDialog (id);
+ if (this.store.get_iter (out iter, path)) {
+ this.store.get (iter, Columns.COLUMN_ID, out id, -1);
+ var dialog = new Xfmpc.SongDialog (id);
dialog.show_all ();
}
}
@@ -220,38 +220,38 @@
private void cb_song_changed () {
refresh_current_song ();
- if (filter_entry.get_text () == "" && autocenter)
- select_row (current);
+ if (filter_entry.get_text () == "" && this.autocenter)
+ select_row (this.current);
}
private void cb_playlist_changed () {
string filename = "", song = "", length = "";
int id = 0, pos = 0;
- current = mpdclient.get_id ();
+ this.current = this.mpdclient.get_id ();
- store.clear ();
+ this.store.clear ();
- while (mpdclient.playlist_read (&id, &pos, &filename, &song, &length)) {
+ while (this.mpdclient.playlist_read (&id, &pos, &filename, &song, &length)) {
append (id, pos, filename, song, length);
}
refresh_current_song ();
- if (filter_entry.get_text () != "" && autocenter)
- select_row (current);
+ if (filter_entry.get_text () != "" && this.autocenter)
+ select_row (this.current);
}
- private void cb_row_activated (TreePath path, TreeViewColumn column) {
- TreeIter iter;
- TreePath new_path = path;
+ private void cb_row_activated (Gtk.TreePath path, Gtk.TreeViewColumn column) {
+ Gtk.TreeIter iter;
+ Gtk.TreePath new_path = path;
int id = 0;
- if (!filter.get_iter (out iter, new_path))
+ if (!this.filter.get_iter (out iter, new_path))
return;
- filter.get (iter, Columns.COLUMN_ID, out id, -1);
- mpdclient.set_id (id);
+ this.filter.get (iter, Columns.COLUMN_ID, out id, -1);
+ this.mpdclient.set_id (id);
}
private bool cb_key_released (Gdk.EventKey event) {
@@ -272,22 +272,22 @@
}
private bool cb_button_released (Gdk.EventButton event) {
- TreePath path;
- TreeSelection selection;
+ Gtk.TreePath path;
+ Gtk.TreeSelection selection;
if (event.type != Gdk.EventType.BUTTON_PRESS || event.button != 3)
return false;
- selection = treeview.get_selection ();
+ selection = this.treeview.get_selection ();
if (selection.count_selected_rows () < 1)
return true;
bool sensitive = selection.count_selected_rows () == 1;
- mi_browse.set_sensitive (sensitive);
- mi_information.set_sensitive (sensitive);
+ this.mi_browse.set_sensitive (sensitive);
+ this.mi_information.set_sensitive (sensitive);
- if (treeview.get_path_at_pos ((int) event.x, (int) event.y,
- out path, null, null, null))
+ if (this.treeview.get_path_at_pos ((int) event.x, (int) event.y,
+ out path, null, null, null))
{
if (!selection.path_is_selected (path)) {
selection.unselect_all ();
@@ -305,14 +305,14 @@
}
private void cb_filter_entry_activated () {
- var list = (treeview.get_selection ()).get_selected_rows (out filter);
+ var list = (this.treeview.get_selection ()).get_selected_rows (out filter);
var path = list.nth_data (0);
if (list.length () > 0) {
- treeview.row_activated (path, treeview.get_column (0));
+ this.treeview.row_activated (path, this.treeview.get_column (0));
filter_entry.set_text ("");
select_row (current);
- treeview.grab_focus ();
+ this.treeview.grab_focus ();
}
}
@@ -324,7 +324,7 @@
if (event.keyval == 0xff1b) {
filter_entry.set_text ("");
select_row (current);
- treeview.grab_focus ();
+ this.treeview.grab_focus ();
}
else {
if (filter_entry.get_text () != "")
@@ -337,7 +337,7 @@
}
private void cb_filter_entry_changed () {
- filter.refilter ();
+ this.filter.refilter ();
}
/*
@@ -345,63 +345,63 @@
*/
public void append (int id, int pos, string filename, string song, string length) {
- TreeIter iter;
+ Gtk.TreeIter iter;
- store.append (out iter);
- store.set (iter,
- Columns.COLUMN_ID, id,
- Columns.COLUMN_FILENAME, filename,
- Columns.COLUMN_POSITION, pos + 1,
- Columns.COLUMN_SONG, song,
- Columns.COLUMN_LENGTH, length,
- Columns.COLUMN_WEIGHT, Pango.Weight.NORMAL,
- -1);
+ this.store.append (out iter);
+ this.store.set (iter,
+ Columns.COLUMN_ID, id,
+ Columns.COLUMN_FILENAME, filename,
+ Columns.COLUMN_POSITION, pos + 1,
+ Columns.COLUMN_SONG, song,
+ Columns.COLUMN_LENGTH, length,
+ Columns.COLUMN_WEIGHT, Pango.Weight.NORMAL,
+ -1);
}
public void refresh_current_song () {
- TreeIter iter;
- TreePath path;
+ Gtk.TreeIter iter;
+ Gtk.TreePath path;
- if (current < 0)
- current = 0;
+ if (this.current < 0)
+ this.current = 0;
- path = new TreePath.from_indices (current, -1);
+ path = new Gtk.TreePath.from_indices (this.current, -1);
- if (store.get_iter (out iter, path))
- store.set (iter, Columns.COLUMN_WEIGHT, Pango.Weight.NORMAL, -1);
+ if (this.store.get_iter (out iter, path))
+ this.store.set (iter, Columns.COLUMN_WEIGHT, Pango.Weight.NORMAL, -1);
- current = mpdclient.get_pos ();
- path = new TreePath.from_indices (current, -1);
- if (store.get_iter (out iter, path))
- store.set (iter, Columns.COLUMN_WEIGHT, Pango.Weight.BOLD, -1);
+ this.current = this.mpdclient.get_pos ();
+ path = new Gtk.TreePath.from_indices (this.current, -1);
+ if (this.store.get_iter (out iter, path))
+ this.store.set (iter, Columns.COLUMN_WEIGHT, Pango.Weight.BOLD, -1);
}
public void select_row (int i) {
- if (current < 0)
+ if (this.current < 0)
return;
- if (filter.iter_n_children (null) == 0)
+ if (this.filter.iter_n_children (null) == 0)
return;
- TreePath path = new TreePath.from_indices (i, -1);
- treeview.set_cursor (path, null, false);
- treeview.scroll_to_cell (path, null, true, (float) 0.42, 0);
+ Gtk.TreePath path = new Gtk.TreePath.from_indices (i, -1);
+ this.treeview.set_cursor (path, null, false);
+ this.treeview.scroll_to_cell (path, null, true, (float) 0.42, 0);
}
public void delete_selection () {
int id = 0;
- TreeIter iter;
- var model = store;
+ Gtk.TreeIter iter;
+ var model = this.store;
- var list = (treeview.get_selection ()).get_selected_rows (out model);
+ var list = (this.treeview.get_selection ()).get_selected_rows (out model);
foreach (Gtk.TreePath path in list) {
- if (store.get_iter (out iter, path)) {
- store.get (iter, Columns.COLUMN_ID, out id, -1);
- mpdclient.queue_remove_id (id);
+ if (this.store.get_iter (out iter, path)) {
+ this.store.get (iter, Columns.COLUMN_ID, out id, -1);
+ this.mpdclient.queue_remove_id (id);
}
}
- mpdclient.queue_commit ();
+ this.mpdclient.queue_commit ();
}
}
}
Modified: xfmpc/trunk/src/preferences-dialog.c
===================================================================
--- xfmpc/trunk/src/preferences-dialog.c 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/preferences-dialog.c 2009-06-16 18:51:39 UTC (rev 7599)
@@ -117,25 +117,15 @@
static void xfmpc_preferences_dialog_cb_update_mpd (XfmpcPreferencesDialog* self, GtkButton* source) {
XfmpcMpdclient* mpdclient;
- const char* _tmp0_;
- char* mpd_hostname;
- const char* _tmp1_;
- char* mpd_password;
g_return_if_fail (self != NULL);
g_return_if_fail (source != NULL);
mpdclient = xfmpc_mpdclient_get ();
- _tmp0_ = NULL;
- mpd_hostname = (_tmp0_ = gtk_entry_get_text (self->priv->entry_host), (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_));
- _tmp1_ = NULL;
- mpd_password = (_tmp1_ = gtk_entry_get_text (self->priv->entry_passwd), (_tmp1_ == NULL) ? NULL : g_strdup (_tmp1_));
- xfmpc_preferences_set_mpd_hostname (self->priv->preferences, mpd_hostname);
+ xfmpc_preferences_set_mpd_hostname (self->priv->preferences, gtk_entry_get_text (self->priv->entry_host));
xfmpc_preferences_set_mpd_port (self->priv->preferences, gtk_spin_button_get_value_as_int (self->priv->entry_port));
- xfmpc_preferences_set_mpd_password (self->priv->preferences, mpd_password);
+ xfmpc_preferences_set_mpd_password (self->priv->preferences, gtk_entry_get_text (self->priv->entry_passwd));
xfmpc_preferences_set_mpd_use_defaults (self->priv->preferences, gtk_toggle_button_get_active ((GtkToggleButton*) self->priv->entry_use_defaults));
xfmpc_mpdclient_disconnect (mpdclient);
xfmpc_mpdclient_connect (mpdclient);
- mpd_hostname = (g_free (mpd_hostname), NULL);
- mpd_password = (g_free (mpd_password), NULL);
}
Modified: xfmpc/trunk/src/preferences-dialog.vala
===================================================================
--- xfmpc/trunk/src/preferences-dialog.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/preferences-dialog.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -25,193 +25,193 @@
private unowned Xfmpc.Preferences preferences;
- private CheckButton entry_use_defaults;
- private Entry entry_host;
- private Entry entry_passwd;
- private SpinButton entry_port;
- private CheckButton show_statusbar;
- private ComboBox combo_format;
- private Entry entry_custom;
+ private Gtk.CheckButton entry_use_defaults;
+ private Gtk.Entry entry_host;
+ private Gtk.Entry entry_passwd;
+ private Gtk.SpinButton entry_port;
+ private Gtk.CheckButton show_statusbar;
+ private Gtk.ComboBox combo_format;
+ private Gtk.Entry entry_custom;
private uint format_timeout;
- private VBox mpd_vbox;
+ private Gtk.VBox mpd_vbox;
construct {
- has_separator = true;
- skip_taskbar_hint = true;
- icon_name = "stock_volume";
- resizable = false;
- title = "Xfmpc Preferences";
+ this.has_separator = true;
+ this.skip_taskbar_hint = true;
+ this.icon_name = "stock_volume";
+ this.resizable = false;
+ this.title = "Xfmpc Preferences";
- preferences = Xfmpc.Preferences.get ();
+ this.preferences = Xfmpc.Preferences.get ();
- var notebook = new Notebook ();
+ var notebook = new Gtk.Notebook ();
notebook.set_border_width (6);
- vbox.pack_start (notebook, true, true, 0);
+ this.vbox.pack_start (notebook, true, true, 0);
/* Mpd Settings */
- var vbox = new VBox (false, 6);
+ var vbox = new Gtk.VBox (false, 6);
vbox.set_border_width (6);
- var label = new Label (_("MPD"));
+ var label = new Gtk.Label (_("MPD"));
notebook.append_page (vbox, label);
- var vbox2 = new VBox (false, 6);
- var frame = Xfce.create_framebox_with_content (_("Connection"), vbox2);
+ var vbox2 = new Gtk.VBox (false, 6);
+ var frame = Xfce.WidgetHelpers.create_framebox_with_content (_("Connection"), vbox2);
vbox.pack_start (frame, false, false, 0);
- entry_use_defaults = new CheckButton.with_mnemonic (_("Use _default system settings"));
- entry_use_defaults.set_tooltip_text (_("If checked, Xfmpc will try to read the environment variables MPD_HOST and MPD_PORT otherwise it will use localhost"));
- entry_use_defaults.set_active (preferences.mpd_use_defaults);
+ this.entry_use_defaults = new Gtk.CheckButton.with_mnemonic (_("Use _default system settings"));
+ this.entry_use_defaults.set_tooltip_text (_("If checked, Xfmpc will try to read the environment variables MPD_HOST and MPD_PORT otherwise it will use localhost"));
+ this.entry_use_defaults.set_active (this.preferences.mpd_use_defaults);
- vbox2.pack_start (entry_use_defaults, false, false, 0);
+ vbox2.pack_start (this.entry_use_defaults, false, false, 0);
- mpd_vbox = new VBox (false, 6);
- vbox2.pack_start (mpd_vbox, false, false, 0);
+ this.mpd_vbox = new Gtk.VBox (false, 6);
+ vbox2.pack_start (this.mpd_vbox, false, false, 0);
- entry_use_defaults.toggled += cb_use_defaults_toggled;
- mpd_vbox.set_sensitive (!entry_use_defaults.get_active ());
+ this.entry_use_defaults.toggled += cb_use_defaults_toggled;
+ this.mpd_vbox.set_sensitive (!this.entry_use_defaults.get_active ());
- var hbox = new HBox (false, 2);
- mpd_vbox.pack_start (hbox, false, false, 0);
+ var hbox = new Gtk.HBox (false, 2);
+ this.mpd_vbox.pack_start (hbox, false, false, 0);
- label = new Label (_("Hostname:"));
+ label = new Gtk.Label (_("Hostname:"));
hbox.pack_start (label, false, false, 0);
- entry_host = new Entry ();
- entry_host.set_width_chars (15);
- entry_host.set_text (preferences.mpd_hostname);
- hbox.pack_start (entry_host, true, true, 0);
+ this.entry_host = new Gtk.Entry ();
+ this.entry_host.set_width_chars (15);
+ this.entry_host.set_text (this.preferences.mpd_hostname);
+ hbox.pack_start (this.entry_host, true, true, 0);
- label = new Label (_("Port:"));
+ label = new Gtk.Label (_("Port:"));
hbox.pack_start (label, false, false, 0);
- entry_port = new SpinButton.with_range (0, 65536, 1);
- entry_port.set_digits (0);
- entry_port.set_value (preferences.mpd_port);
- hbox.pack_start (entry_port, true, true, 0);
+ this.entry_port = new Gtk.SpinButton.with_range (0, 65536, 1);
+ this.entry_port.set_digits (0);
+ this.entry_port.set_value (this.preferences.mpd_port);
+ hbox.pack_start (this.entry_port, true, true, 0);
- hbox = new HBox (false, 2);
- mpd_vbox.pack_start (hbox, false, false, 0);
+ hbox = new Gtk.HBox (false, 2);
+ this.mpd_vbox.pack_start (hbox, false, false, 0);
- label = new Label (_("Password:"));
+ label = new Gtk.Label (_("Password:"));
hbox.pack_start (label, false, false, 0);
- entry_passwd = new Entry ();
- entry_passwd.set_visibility (false);
- if (preferences.mpd_password != null)
- entry_passwd.set_text (preferences.mpd_password);
- hbox.pack_start (entry_passwd, true, true, 0);
+ this.entry_passwd = new Gtk.Entry ();
+ this.entry_passwd.set_visibility (false);
+ if (this.preferences.mpd_password != null)
+ this.entry_passwd.set_text (this.preferences.mpd_password);
+ hbox.pack_start (this.entry_passwd, true, true, 0);
- var button = new Button.from_stock (Gtk.STOCK_APPLY);
+ var button = new Gtk.Button.from_stock (Gtk.STOCK_APPLY);
button.clicked += cb_update_mpd;
vbox2.pack_start (button, true, true, 0);
/* Display */
- vbox = new VBox (false, 6);
+ vbox = new Gtk.VBox (false, 6);
vbox.set_border_width (6);
- label = new Label (_("Appearance"));
+ label = new Gtk.Label (_("Appearance"));
notebook.append_page (vbox, label);
- vbox2 = new VBox (false, 6);
- frame = Xfce.create_framebox_with_content (_("Statusbar"), vbox2);
+ vbox2 = new Gtk.VBox (false, 6);
+ frame = Xfce.WidgetHelpers.create_framebox_with_content (_("Statusbar"), vbox2);
vbox.pack_start (frame, false, false, 0);
- show_statusbar = new CheckButton.with_mnemonic (_("Show _stastusbar"));
- show_statusbar.set_active (preferences.show_statusbar);
- show_statusbar.toggled += cb_show_statusbar_toggled;
- vbox2.pack_start (show_statusbar, false, false, 0);
+ this.show_statusbar = new Gtk.CheckButton.with_mnemonic (_("Show _stastusbar"));
+ this.show_statusbar.set_active (this.preferences.show_statusbar);
+ this.show_statusbar.toggled += cb_show_statusbar_toggled;
+ vbox2.pack_start (this.show_statusbar, false, false, 0);
- vbox2 = new VBox (false, 6);
- frame = Xfce.create_framebox_with_content (_("Song Format"), vbox2);
+ vbox2 = new Gtk.VBox (false, 6);
+ frame = Xfce.WidgetHelpers.create_framebox_with_content (_("Song Format"), vbox2);
vbox.pack_start (frame, false, false, 0);
- hbox = new HBox (false, 2);
+ hbox = new Gtk.HBox (false, 2);
- label = new Label (_("Song Format:"));
+ label = new Gtk.Label (_("Song Format:"));
hbox.pack_start (label, false, false, 0);
- combo_format = new ComboBox.text ();
- hbox.pack_start (combo_format, true, true, 0);
+ this.combo_format = new Gtk.ComboBox.text ();
+ hbox.pack_start (this.combo_format, true, true, 0);
- combo_format.append_text (_("Title"));
- combo_format.append_text (_("Album - Title"));
- combo_format.append_text (_("Artist - Title"));
- combo_format.append_text (_("Artist - Title (Date)"));
- combo_format.append_text (_("Artist - Album - Title"));
- combo_format.append_text (_("Artist - Album - Track. Title"));
- combo_format.append_text (_("Custom..."));
+ this.combo_format.append_text (_("Title"));
+ this.combo_format.append_text (_("Album - Title"));
+ this.combo_format.append_text (_("Artist - Title"));
+ this.combo_format.append_text (_("Artist - Title (Date)"));
+ this.combo_format.append_text (_("Artist - Album - Title"));
+ this.combo_format.append_text (_("Artist - Album - Track. Title"));
+ this.combo_format.append_text (_("Custom..."));
- combo_format.set_active (preferences.song_format);
+ this.combo_format.set_active (this.preferences.song_format);
vbox2.pack_start (hbox, true, true, 0);
- hbox = new HBox (false, 2);
+ hbox = new Gtk.HBox (false, 2);
- label = new Label (_("Custom format:"));
+ label = new Gtk.Label (_("Custom format:"));
hbox.pack_start (label, false, false, 0);
- entry_custom = new Entry ();
- entry_custom.set_width_chars (15);
- entry_custom.set_max_length (30);
- entry_custom.set_text (preferences.song_format_custom);
- entry_custom.set_sensitive (combo_format.get_active () == 6);
- hbox.pack_start (entry_custom, true, true, 0);
+ this.entry_custom = new Gtk.Entry ();
+ this.entry_custom.set_width_chars (15);
+ this.entry_custom.set_max_length (30);
+ this.entry_custom.set_text (this.preferences.song_format_custom);
+ this.entry_custom.set_sensitive (this.combo_format.get_active () == 6);
+ hbox.pack_start (this.entry_custom, true, true, 0);
- combo_format.changed += cb_combo_format_changed;
- entry_custom.changed += cb_entry_custom_changed;
+ this.combo_format.changed += cb_combo_format_changed;
+ this.entry_custom.changed += cb_entry_custom_changed;
vbox2.pack_start (hbox, true, true, 0);
- label = new Label (_("Available parameters:"));
+ label = new Gtk.Label (_("Available parameters:"));
vbox2.pack_start (label, true, true, 0);
- var table = new Table (4, 6, true);
+ var table = new Gtk.Table (4, 6, true);
var attrs = new Pango.AttrList ();
attrs.insert (Pango.attr_scale_new ((double) Pango.Scale.SMALL));
- label = new Label (_("%a: Artist"));
+ label = new Gtk.Label (_("%a: Artist"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 1, 3, 0, 1);
- label = new Label (_("%A: Album"));
+ label = new Gtk.Label (_("%A: Album"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 4, 6, 0, 1);
- label = new Label (_("%d: Date"));
+ label = new Gtk.Label (_("%d: Date"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 1, 3, 1, 2);
- label = new Label (_("%D: Disc"));
+ label = new Gtk.Label (_("%D: Disc"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 4, 6, 1, 2);
- label = new Label (_("%f: File"));
+ label = new Gtk.Label (_("%f: File"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 1, 3, 2, 3);
- label = new Label (_("%g: Genre"));
+ label = new Gtk.Label (_("%g: Genre"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 4, 6, 2, 3);
- label = new Label (_("%t: Title"));
+ label = new Gtk.Label (_("%t: Title"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 1, 3, 3, 4);
- label = new Label (_("%T: Track"));
+ label = new Gtk.Label (_("%T: Track"));
label.set_attributes (attrs);
label.set_alignment (0, (float) 0.5);
table.attach_defaults (label, 4, 6, 3, 4);
vbox2.pack_start (table, true, true, 0);
- add_button (STOCK_CLOSE, ResponseType.CLOSE);
+ add_button (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
show_all ();
/* Signals */
- response += cb_response;
+ this.response += cb_response;
}
/*
@@ -220,61 +220,59 @@
private void cb_response (PreferencesDialog source, int response) {
switch (response) {
- case ResponseType.CLOSE:
+ case Gtk.ResponseType.CLOSE:
destroy ();
break;
}
}
- private void cb_use_defaults_toggled (CheckButton source) {
- mpd_vbox.set_sensitive (!entry_use_defaults.get_active ());
+ private void cb_use_defaults_toggled (Gtk.CheckButton source) {
+ this.mpd_vbox.set_sensitive (!this.entry_use_defaults.get_active ());
}
- private void cb_update_mpd (Button source) {
+ private void cb_update_mpd (Gtk.Button source) {
unowned Xfmpc.Mpdclient mpdclient = Xfmpc.Mpdclient.get ();
- string mpd_hostname = entry_host.get_text ();
- string mpd_password = entry_passwd.get_text ();
- preferences.mpd_hostname = mpd_hostname;
- preferences.mpd_port = entry_port.get_value_as_int ();
- preferences.mpd_password = mpd_password;
- preferences.mpd_use_defaults = entry_use_defaults.get_active ();
+ this.preferences.mpd_hostname = this.entry_host.get_text ();
+ this.preferences.mpd_port = this.entry_port.get_value_as_int ();
+ this.preferences.mpd_password = this.entry_passwd.get_text ();
+ this.preferences.mpd_use_defaults = this.entry_use_defaults.get_active ();
mpdclient.disconnect ();
mpdclient.connect ();
}
- private void cb_show_statusbar_toggled (CheckButton source) {
- preferences.show_statusbar = show_statusbar.get_active ();
+ private void cb_show_statusbar_toggled (Gtk.CheckButton source) {
+ this.preferences.show_statusbar = this.show_statusbar.get_active ();
}
- private void cb_combo_format_changed (ComboBox source) {
+ private void cb_combo_format_changed (Gtk.ComboBox source) {
switch (combo_format.get_active ())
{
- case 0: preferences.song_format = Xfmpc.SongFormat.TITLE; break;
- case 1: preferences.song_format = Xfmpc.SongFormat.ALBUM_TITLE; break;
- case 2: preferences.song_format = Xfmpc.SongFormat.ARTIST_TITLE; break;
- case 3: preferences.song_format = Xfmpc.SongFormat.ARTIST_TITLE_DATE; break;
- case 4: preferences.song_format = Xfmpc.SongFormat.ARTIST_ALBUM_TITLE; break;
- case 5: preferences.song_format = Xfmpc.SongFormat.ARTIST_ALBUM_TRACK_TITLE; break;
- case 6: preferences.song_format = Xfmpc.SongFormat.CUSTOM; break;
- default: preferences.song_format = Xfmpc.SongFormat.TITLE; break;
+ case 0: this.preferences.song_format = Xfmpc.SongFormat.TITLE; break;
+ case 1: this.preferences.song_format = Xfmpc.SongFormat.ALBUM_TITLE; break;
+ case 2: this.preferences.song_format = Xfmpc.SongFormat.ARTIST_TITLE; break;
+ case 3: this.preferences.song_format = Xfmpc.SongFormat.ARTIST_TITLE_DATE; break;
+ case 4: this.preferences.song_format = Xfmpc.SongFormat.ARTIST_ALBUM_TITLE; break;
+ case 5: this.preferences.song_format = Xfmpc.SongFormat.ARTIST_ALBUM_TRACK_TITLE; break;
+ case 6: this.preferences.song_format = Xfmpc.SongFormat.CUSTOM; break;
+ default: this.preferences.song_format = Xfmpc.SongFormat.TITLE; break;
}
- entry_custom.set_sensitive (combo_format.get_active () == 6);
+ this.entry_custom.set_sensitive (this.combo_format.get_active () == 6);
}
- private void cb_entry_custom_changed (Entry source) {
- if (format_timeout > 0)
- Source.remove (format_timeout);
+ private void cb_entry_custom_changed (Gtk.Entry source) {
+ if (this.format_timeout > 0)
+ GLib.Source.remove (this.format_timeout);
- format_timeout = Timeout.add_seconds_full (Priority.DEFAULT, 1, timeout_format);
+ this.format_timeout = GLib.Timeout.add_seconds_full (GLib.Priority.DEFAULT, 1, timeout_format);
}
private bool timeout_format () {
- string custom_format = entry_custom.get_text ();
- preferences.song_format_custom = custom_format;
+ string custom_format = this.entry_custom.get_text ();
+ this.preferences.song_format_custom = custom_format;
return false;
}
}
Added: xfmpc/trunk/src/preferences.vapi
===================================================================
--- xfmpc/trunk/src/preferences.vapi (rev 0)
+++ xfmpc/trunk/src/preferences.vapi 2009-06-16 18:51:39 UTC (rev 7599)
@@ -0,0 +1,37 @@
+/* preferences.vapi generated by vapigen, do not modify. */
+
+[CCode (cprefix = "Xfmpc", lower_case_cprefix = "xfmpc_")]
+namespace Xfmpc {
+ [Compact]
+ [CCode (cheader_filename = "preferences.h")]
+ public class Preferences {
+ public static unowned Xfmpc.Preferences get ();
+ public int last_window_posx {get; set; }
+ public int last_window_posy { get; set; }
+ public int last_window_width { get; set; }
+ public int last_window_height { get; set; }
+ public bool last_window_state_sticky { get; set; }
+ public bool playlist_autocenter { get; set; }
+ public string dbbrowser_last_path { get; set; }
+ public string mpd_hostname { get; set; }
+ public int mpd_port { get; set; }
+ public string mpd_password { get; set; }
+ public bool mpd_use_defaults { get; set; }
+ public bool show_statusbar { get; set; }
+ public int song_format { get; set; }
+ public string song_format_custom { get; set; }
+ public virtual signal void notify (GLib.ParamSpec pspec);
+ }
+ [CCode (cprefix = "XFMPC_SONG_FORMAT_", has_type_id = "0", cheader_filename = "preferences.h")]
+ public enum SongFormat {
+ TITLE,
+ ALBUM_TITLE,
+ ARTIST_TITLE,
+ ARTIST_TITLE_DATE,
+ ARTIST_ALBUM_TITLE,
+ ARTIST_ALBUM_TRACK_TITLE,
+ CUSTOM
+ }
+ [CCode (cheader_filename = "preferences.h")]
+ public static GLib.Type song_format_get_type ();
+}
Modified: xfmpc/trunk/src/song-dialog.vala
===================================================================
--- xfmpc/trunk/src/song-dialog.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/song-dialog.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -27,85 +27,85 @@
private unowned Xfmpc.SongInfo song;
public SongDialog (int song_id) {
- has_separator = true;
- skip_taskbar_hint = true;
- icon_name = "stock_volume";
- resizable = false;
+ this.has_separator = true;
+ this.skip_taskbar_hint = true;
+ this.icon_name = "stock_volume";
+ this.resizable = false;
- mpdclient = Xfmpc.Mpdclient.get ();
- song = mpdclient.get_song_info (song_id);
+ this.mpdclient = Xfmpc.Mpdclient.get ();
+ this.song = mpdclient.get_song_info (song_id);
- title = song.title;
+ this.title = this.song.title;
- vbox.set_spacing (0);
+ this.vbox.set_spacing (0);
- var vbox2 = new VBox (false, 0);
- var frame = Xfce.create_framebox_with_content ("", vbox2);
+ var vbox2 = new Gtk.VBox (false, 0);
+ var frame = Xfce.WidgetHelpers.create_framebox_with_content ("", vbox2);
var attrs = new Pango.AttrList ();
attrs.insert (Pango.attr_weight_new (Pango.Weight.BOLD));
- var hbox = new HBox (false, 0);
- var label = new Label (_("File"));
+ var hbox = new Gtk.HBox (false, 0);
+ var label = new Gtk.Label (_("File"));
label.set_attributes (attrs);
hbox.pack_start (label, false, false, 5);
- label = new Label (Path.get_basename (song.filename));
+ label = new Gtk.Label (GLib.Path.get_basename (song.filename));
hbox.pack_start (label, false, false, 5);
vbox2.pack_start (hbox, false, false, 6);
- hbox = new HBox (false, 0);
- label = new Label (_("Artist"));
+ hbox = new Gtk.HBox (false, 0);
+ label = new Gtk.Label (_("Artist"));
label.set_attributes (attrs);
hbox.pack_start (label, false, false, 5);
- label = new Label (song.artist);
+ label = new Gtk.Label (song.artist);
hbox.pack_start (label, false, false, 5);
vbox2.pack_start (hbox, false, false, 6);
- hbox = new HBox (false, 0);
- label = new Label (_("Title"));
+ hbox = new Gtk.HBox (false, 0);
+ label = new Gtk.Label (_("Title"));
label.set_attributes (attrs);
hbox.pack_start (label, false, false, 5);
- label = new Label (song.title);
+ label = new Gtk.Label (song.title);
hbox.pack_start (label, false, false, 5);
vbox2.pack_start (hbox, false, false, 6);
- hbox = new HBox (false, 0);
- label = new Label (_("Album"));
+ hbox = new Gtk.HBox (false, 0);
+ label = new Gtk.Label (_("Album"));
label.set_attributes (attrs);
hbox.pack_start (label, false, false, 5);
- label = new Label (song.album);
+ label = new Gtk.Label (song.album);
hbox.pack_start (label, false, false, 5);
vbox2.pack_start (hbox, false, false, 6);
- hbox = new HBox (false, 0);
- label = new Label (_("Date"));
+ hbox = new Gtk.HBox (false, 0);
+ label = new Gtk.Label (_("Date"));
label.set_attributes (attrs);
hbox.pack_start (label, false, false, 5);
- label = new Label (song.date);
+ label = new Gtk.Label (song.date);
hbox.pack_start (label, false, false, 5);
- label = new Label (_("Track"));
+ label = new Gtk.Label (_("Track"));
label.set_attributes (attrs);
hbox.pack_start (label, false, false, 15);
- label = new Label (song.track);
+ label = new Gtk.Label (song.track);
hbox.pack_start (label, false, false, 5);
vbox2.pack_start (hbox, false, false, 6);
- hbox = new HBox (false, 0);
- label = new Label (_("Genre"));
+ hbox = new Gtk.HBox (false, 0);
+ label = new Gtk.Label (_("Genre"));
label.set_attributes (attrs);
hbox.pack_start (label, false, false, 5);
- label = new Label (song.genre);
+ label = new Gtk.Label (song.genre);
hbox.pack_start (label, false, false, 5);
vbox2.pack_start (hbox, false, false, 6);
vbox.pack_start (frame, true, true, 0);
- add_button (STOCK_CLOSE, ResponseType.CLOSE);
+ add_button (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
show_all ();
/* Signals */
- response += cb_response;
+ this.response += cb_response;
}
/*
@@ -114,7 +114,7 @@
private void cb_response (SongDialog source, int response) {
switch (response) {
- case ResponseType.CLOSE:
+ case Gtk.ResponseType.CLOSE:
destroy ();
break;
}
Modified: xfmpc/trunk/src/statusbar.vala
===================================================================
--- xfmpc/trunk/src/statusbar.vala 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/statusbar.vala 2009-06-16 18:51:39 UTC (rev 7599)
@@ -29,14 +29,14 @@
public string text {
set {
_text = value;
- pop (context_id);
- push (context_id, _text);
+ pop (this.context_id);
+ push (this.context_id, _text);
}
}
construct {
set_has_resize_grip (false);
- context_id = get_context_id ("Main text");
+ this.context_id = get_context_id ("Main text");
}
}
Added: xfmpc/trunk/src/xfce-arrow-button.vapi
===================================================================
--- xfmpc/trunk/src/xfce-arrow-button.vapi (rev 0)
+++ xfmpc/trunk/src/xfce-arrow-button.vapi 2009-06-16 18:51:39 UTC (rev 7599)
@@ -0,0 +1,16 @@
+/* xfce-arrow-button.vapi generated by vapigen, do not modify. */
+
+[CCode (cprefix = "Xfce", lower_case_cprefix = "xfce_")]
+namespace Xfce {
+ [CCode (free_function = "")]
+ [Compact]
+ [CCode (cheader_filename = "xfce-arrow-button.h")]
+ public class ArrowButton {
+ public Gtk.ArrowType arrow_type;
+ public weak Gtk.ToggleButton parent;
+ public Gtk.ArrowType get_arrow_type ();
+ [CCode (type = "GtkWidget*", has_construct_function = false)]
+ public ArrowButton (Gtk.ArrowType type);
+ public void set_arrow_type (Gtk.ArrowType type);
+ }
+}
Modified: xfmpc/trunk/src/xfmpc.h
===================================================================
--- xfmpc/trunk/src/xfmpc.h 2009-06-16 15:08:39 UTC (rev 7598)
+++ xfmpc/trunk/src/xfmpc.h 2009-06-16 18:51:39 UTC (rev 7599)
@@ -192,7 +192,6 @@
XfmpcStatusbar* xfmpc_statusbar_construct (GType object_type);
void xfmpc_statusbar_set_text (XfmpcStatusbar* self, const char* value);
GType xfmpc_dbbrowser_get_type (void);
-void xfmpc_dbbrowser_free (XfmpcDbbrowser* self);
void xfmpc_dbbrowser_reload (XfmpcDbbrowser* self);
gboolean xfmpc_dbbrowser_wdir_is_root (XfmpcDbbrowser* self);
char* xfmpc_dbbrowser_get_parent_wdir (XfmpcDbbrowser* self);
More information about the Goodies-commits
mailing list