[Goodies-commits] r7309 - in xfmpc/trunk: . src vapi
Vincent Legout
vincent at xfce.org
Sun May 3 01:06:23 CEST 2009
Author: vincent
Date: 2009-05-02 23:06:23 +0000 (Sat, 02 May 2009)
New Revision: 7309
Added:
xfmpc/trunk/src/interface.vala
xfmpc/trunk/src/main-window.vala
Removed:
xfmpc/trunk/src/interface.h
xfmpc/trunk/src/main-window.h
Modified:
xfmpc/trunk/ChangeLog
xfmpc/trunk/src/Makefile.am
xfmpc/trunk/src/dbbrowser.c
xfmpc/trunk/src/extended-interface.c
xfmpc/trunk/src/interface.c
xfmpc/trunk/src/main-window.c
xfmpc/trunk/src/main.c
xfmpc/trunk/src/playlist.c
xfmpc/trunk/src/preferences-dialog.c
xfmpc/trunk/src/song-dialog.c
xfmpc/trunk/src/statusbar.c
xfmpc/trunk/src/xfmpc.h
xfmpc/trunk/vapi/config.vapi
xfmpc/trunk/vapi/mpdclient.vapi
xfmpc/trunk/vapi/preferences.vapi
Log:
Rewrite interface.c and main-window.c in vala
Modified: xfmpc/trunk/ChangeLog
===================================================================
--- xfmpc/trunk/ChangeLog 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/ChangeLog 2009-05-02 23:06:23 UTC (rev 7309)
@@ -1,3 +1,20 @@
+2009-05-02 Vincent Legout <vincent at legout.info>
+
+Rewrite interface.c and main-window.c in vala
+ * src/Makefile.am:
+ - Build interface.vala and main-window.vala
+ * src/interface.vala, main-window.vala:
+ - New files
+ * src/main.c:
+ - Include xfmpc.h
+ * vapi/config.vapi:
+ - Add PACKAGE_STRING and PACKAGE_NAME
+ * vapi/mpdclient.vapi:
+ - Update signals. Add arguments to pp_changed, time_changed and
+ volume_changed
+ * vapi/preferences.vapi:
+ - Make last_window_posx a property
+
2009-04-22 Vincent Legout <vincent at legout.info>
Start to rewrite in vala
Modified: xfmpc/trunk/src/Makefile.am
===================================================================
--- xfmpc/trunk/src/Makefile.am 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/Makefile.am 2009-05-02 23:06:23 UTC (rev 7309)
@@ -6,6 +6,8 @@
statusbar.vala \
dbbrowser.vala \
extended-interface.vala \
+ interface.vala \
+ main-window.vala \
playlist.vala
vala_built_SOURCES = \
@@ -26,13 +28,9 @@
endif
-xfmpc_SOURCES = \
+xfmpc_SOURCES = \
main.c \
main-ui.h \
- main-window.c \
- main-window.h \
- interface.c \
- interface.h \
preferences.c \
preferences.h \
mpdclient.c \
@@ -63,7 +61,7 @@
EXTRA_DIST = \
main-ui.xml \
- $(xfce4_notes_plugin_VALASOURCES)
+ $(xfmpc_VALASOURCES)
DISTCLEANFILES = \
main-ui.h \
Modified: xfmpc/trunk/src/dbbrowser.c
===================================================================
--- xfmpc/trunk/src/dbbrowser.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/dbbrowser.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -175,9 +175,9 @@
}
xfmpc_dbbrowser_clear (self);
if (!xfmpc_dbbrowser_wdir_is_root (self)) {
- char* _tmp0;
- _tmp0 = NULL;
- filename = (_tmp0 = xfmpc_dbbrowser_get_parent_wdir (self), filename = (g_free (filename), NULL), _tmp0);
+ char* _tmp0_;
+ _tmp0_ = NULL;
+ filename = (_tmp0_ = xfmpc_dbbrowser_get_parent_wdir (self), filename = (g_free (filename), NULL), _tmp0_);
xfmpc_dbbrowser_append (self, filename, "..", TRUE, FALSE);
i++;
}
@@ -207,19 +207,19 @@
char* xfmpc_dbbrowser_get_parent_wdir (XfmpcDbbrowser* self) {
- const char* _tmp0;
+ const char* _tmp0_;
char* filename;
g_return_val_if_fail (self != NULL, NULL);
- _tmp0 = NULL;
- filename = (_tmp0 = strstr (self->priv->wdir, "/"), (_tmp0 == NULL) ? NULL : g_strdup (_tmp0));
+ _tmp0_ = NULL;
+ filename = (_tmp0_ = strstr (self->priv->wdir, "/"), (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_));
if (filename == NULL) {
- char* _tmp1;
- _tmp1 = NULL;
- return (_tmp1 = g_strdup (""), filename = (g_free (filename), NULL), _tmp1);
+ char* _tmp1_;
+ _tmp1_ = NULL;
+ return (_tmp1_ = g_strdup (""), filename = (g_free (filename), NULL), _tmp1_);
} else {
- char* _tmp2;
- _tmp2 = NULL;
- return (_tmp2 = g_path_get_dirname (self->priv->wdir), filename = (g_free (filename), NULL), _tmp2);
+ char* _tmp2_;
+ _tmp2_ = NULL;
+ return (_tmp2_ = g_path_get_dirname (self->priv->wdir), filename = (g_free (filename), NULL), _tmp2_);
}
filename = (g_free (filename), NULL);
}
@@ -227,44 +227,44 @@
void xfmpc_dbbrowser_append (XfmpcDbbrowser* self, const char* filename, const char* basename, gboolean is_dir, gboolean is_bold) {
GtkTreeIter iter = {0};
- const char* _tmp0;
+ const char* _tmp0_;
GdkPixbuf* pixbuf;
- PangoWeight _tmp1;
+ PangoWeight _tmp1_;
g_return_if_fail (self != NULL);
g_return_if_fail (filename != NULL);
g_return_if_fail (basename != NULL);
- _tmp0 = NULL;
+ _tmp0_ = NULL;
if (is_dir) {
- _tmp0 = GTK_STOCK_DIRECTORY;
+ _tmp0_ = GTK_STOCK_DIRECTORY;
} else {
- _tmp0 = GTK_STOCK_FILE;
+ _tmp0_ = GTK_STOCK_FILE;
}
- pixbuf = gtk_widget_render_icon ((GtkWidget*) self->priv->treeview, _tmp0, GTK_ICON_SIZE_MENU, NULL);
+ pixbuf = gtk_widget_render_icon ((GtkWidget*) self->priv->treeview, _tmp0_, GTK_ICON_SIZE_MENU, NULL);
gtk_list_store_append (self->priv->store, &iter);
- _tmp1 = 0;
+ _tmp1_ = 0;
if (is_bold) {
- _tmp1 = PANGO_WEIGHT_BOLD;
+ _tmp1_ = PANGO_WEIGHT_BOLD;
} else {
- _tmp1 = PANGO_WEIGHT_NORMAL;
+ _tmp1_ = PANGO_WEIGHT_NORMAL;
}
- gtk_list_store_set (self->priv->store, &iter, XFMPC_DBBROWSER_COLUMNS_COLUMN_PIXBUF, pixbuf, XFMPC_DBBROWSER_COLUMNS_COLUMN_FILENAME, filename, XFMPC_DBBROWSER_COLUMNS_COLUMN_BASENAME, basename, XFMPC_DBBROWSER_COLUMNS_COLUMN_IS_DIR, is_dir, XFMPC_DBBROWSER_COLUMNS_COLUMN_WEIGHT, _tmp1, -1, -1);
+ gtk_list_store_set (self->priv->store, &iter, XFMPC_DBBROWSER_COLUMNS_COLUMN_PIXBUF, pixbuf, XFMPC_DBBROWSER_COLUMNS_COLUMN_FILENAME, filename, XFMPC_DBBROWSER_COLUMNS_COLUMN_BASENAME, basename, XFMPC_DBBROWSER_COLUMNS_COLUMN_IS_DIR, is_dir, XFMPC_DBBROWSER_COLUMNS_COLUMN_WEIGHT, _tmp1_, -1, -1);
(pixbuf == NULL) ? NULL : (pixbuf = (g_object_unref (pixbuf), NULL));
}
void xfmpc_dbbrowser_set_wdir (XfmpcDbbrowser* self, const char* dir) {
- char* _tmp1;
- const char* _tmp0;
- char* _tmp3;
- const char* _tmp2;
+ char* _tmp1_;
+ const char* _tmp0_;
+ char* _tmp3_;
+ const char* _tmp2_;
g_return_if_fail (self != NULL);
g_return_if_fail (dir != NULL);
- _tmp1 = NULL;
- _tmp0 = NULL;
- self->priv->last_wdir = (_tmp1 = (_tmp0 = self->priv->wdir, (_tmp0 == NULL) ? NULL : g_strdup (_tmp0)), self->priv->last_wdir = (g_free (self->priv->last_wdir), NULL), _tmp1);
- _tmp3 = NULL;
- _tmp2 = NULL;
- self->priv->wdir = (_tmp3 = (_tmp2 = dir, (_tmp2 == NULL) ? NULL : g_strdup (_tmp2)), self->priv->wdir = (g_free (self->priv->wdir), NULL), _tmp3);
+ _tmp1_ = NULL;
+ _tmp0_ = NULL;
+ self->priv->last_wdir = (_tmp1_ = (_tmp0_ = self->priv->wdir, (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_)), self->priv->last_wdir = (g_free (self->priv->last_wdir), NULL), _tmp1_);
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ self->priv->wdir = (_tmp3_ = (_tmp2_ = dir, (_tmp2_ == NULL) ? NULL : g_strdup (_tmp2_)), self->priv->wdir = (g_free (self->priv->wdir), NULL), _tmp3_);
}
@@ -275,33 +275,33 @@
void xfmpc_dbbrowser_add_selected_rows (XfmpcDbbrowser* self) {
- GtkTreeModel* _tmp0;
+ GtkTreeModel* _tmp0_;
GtkTreeModel* model;
GtkTreeIter iter = {0};
char* filename;
- GtkTreeModel* _tmp4;
- GtkTreeModel* _tmp3;
- GList* _tmp2;
- GtkTreeModel* _tmp1;
+ GtkTreeModel* _tmp4_;
+ GtkTreeModel* _tmp3_;
+ GList* _tmp2_;
+ GtkTreeModel* _tmp1_;
GList* list;
g_return_if_fail (self != NULL);
- _tmp0 = NULL;
- model = (_tmp0 = (GtkTreeModel*) self->priv->store, (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
+ _tmp0_ = NULL;
+ model = (_tmp0_ = (GtkTreeModel*) self->priv->store, (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
filename = g_strdup ("");
- _tmp4 = NULL;
- _tmp3 = NULL;
- _tmp2 = NULL;
- _tmp1 = NULL;
- list = (_tmp2 = gtk_tree_selection_get_selected_rows (gtk_tree_view_get_selection (self->priv->treeview), &_tmp1), model = (_tmp3 = (_tmp4 = _tmp1, (_tmp4 == NULL) ? NULL : g_object_ref (_tmp4)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp3), _tmp2);
+ _tmp4_ = NULL;
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ _tmp1_ = NULL;
+ list = (_tmp2_ = gtk_tree_selection_get_selected_rows (gtk_tree_view_get_selection (self->priv->treeview), &_tmp1_), model = (_tmp3_ = (_tmp4_ = _tmp1_, (_tmp4_ == NULL) ? NULL : g_object_ref (_tmp4_)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp3_), _tmp2_);
{
GList* path_collection;
GList* path_it;
path_collection = list;
for (path_it = path_collection; path_it != NULL; path_it = path_it->next) {
- const GtkTreePath* _tmp5;
+ const GtkTreePath* _tmp5_;
GtkTreePath* path;
- _tmp5 = NULL;
- path = (_tmp5 = (const GtkTreePath*) path_it->data, (_tmp5 == NULL) ? NULL : gtk_tree_path_copy (_tmp5));
+ _tmp5_ = NULL;
+ path = (_tmp5_ = (const GtkTreePath*) path_it->data, (_tmp5_ == NULL) ? NULL : gtk_tree_path_copy (_tmp5_));
{
if (gtk_tree_model_get_iter (model, &iter, path)) {
gtk_tree_model_get (model, &iter, XFMPC_DBBROWSER_COLUMNS_COLUMN_FILENAME, &filename, -1, -1);
@@ -326,7 +326,7 @@
gboolean no_result_buf;
gboolean no_result;
GdkColor color = {0};
- gboolean _tmp0;
+ gboolean _tmp0_;
g_return_if_fail (self != NULL);
g_return_if_fail (query != NULL);
filename = g_strdup ("");
@@ -358,24 +358,24 @@
no_result = FALSE;
}
}
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
if (no_result == no_result_buf) {
- _tmp0 = no_result;
+ _tmp0_ = no_result;
} else {
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
}
- if (_tmp0) {
+ if (_tmp0_) {
gtk_widget_modify_bg ((GtkWidget*) self->priv->search_entry, GTK_STATE_NORMAL, &color);
gtk_widget_modify_bg ((GtkWidget*) self->priv->search_entry, GTK_STATE_SELECTED, &color);
} else {
- gboolean _tmp1;
- _tmp1 = FALSE;
+ gboolean _tmp1_;
+ _tmp1_ = FALSE;
if (no_result == no_result_buf) {
- _tmp1 = !no_result;
+ _tmp1_ = !no_result;
} else {
- _tmp1 = FALSE;
+ _tmp1_ = FALSE;
}
- if (_tmp1) {
+ if (_tmp1_) {
gtk_widget_modify_bg ((GtkWidget*) self->priv->search_entry, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_bg ((GtkWidget*) self->priv->search_entry, GTK_STATE_SELECTED, NULL);
}
@@ -401,23 +401,23 @@
static void xfmpc_dbbrowser_menu_popup (XfmpcDbbrowser* self) {
- GtkTreeSelection* _tmp0;
+ GtkTreeSelection* _tmp0_;
GtkTreeSelection* selection;
gint count;
g_return_if_fail (self != NULL);
- _tmp0 = NULL;
- selection = (_tmp0 = gtk_tree_view_get_selection (self->priv->treeview), (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
+ _tmp0_ = NULL;
+ selection = (_tmp0_ = gtk_tree_view_get_selection (self->priv->treeview), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
count = gtk_tree_selection_count_selected_rows (selection);
if (self->priv->is_searching) {
- gboolean _tmp1;
+ gboolean _tmp1_;
gtk_widget_show ((GtkWidget*) self->priv->mi_browse);
- _tmp1 = FALSE;
+ _tmp1_ = FALSE;
if (count == 1) {
- _tmp1 = TRUE;
+ _tmp1_ = TRUE;
} else {
- _tmp1 = FALSE;
+ _tmp1_ = FALSE;
}
- gtk_widget_set_sensitive ((GtkWidget*) self->priv->mi_browse, _tmp1);
+ gtk_widget_set_sensitive ((GtkWidget*) self->priv->mi_browse, _tmp1_);
} else {
gtk_widget_hide ((GtkWidget*) self->priv->mi_browse);
}
@@ -430,15 +430,15 @@
* Signal callbacks
*/
static void xfmpc_dbbrowser_cb_playlist_changed (XfmpcDbbrowser* self) {
- GtkTreeModel* _tmp0;
+ GtkTreeModel* _tmp0_;
GtkTreeModel* model;
GtkTreeIter iter = {0};
char* filename;
gboolean is_bold;
gboolean is_dir;
g_return_if_fail (self != NULL);
- _tmp0 = NULL;
- model = (_tmp0 = (GtkTreeModel*) self->priv->store, (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
+ _tmp0_ = NULL;
+ model = (_tmp0_ = (GtkTreeModel*) self->priv->store, (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
filename = g_strdup ("");
is_bold = FALSE;
is_dir = FALSE;
@@ -448,16 +448,16 @@
return;
}
do {
- PangoWeight _tmp1;
+ PangoWeight _tmp1_;
gtk_tree_model_get (model, &iter, XFMPC_DBBROWSER_COLUMNS_COLUMN_FILENAME, &filename, XFMPC_DBBROWSER_COLUMNS_COLUMN_IS_DIR, &is_dir, -1, -1);
is_bold = xfmpc_mpdclient_playlist_has_filename (self->priv->mpdclient, filename, is_dir);
- _tmp1 = 0;
+ _tmp1_ = 0;
if (is_bold) {
- _tmp1 = PANGO_WEIGHT_BOLD;
+ _tmp1_ = PANGO_WEIGHT_BOLD;
} else {
- _tmp1 = PANGO_WEIGHT_NORMAL;
+ _tmp1_ = PANGO_WEIGHT_NORMAL;
}
- gtk_list_store_set (self->priv->store, &iter, XFMPC_DBBROWSER_COLUMNS_COLUMN_WEIGHT, _tmp1, -1, -1);
+ gtk_list_store_set (self->priv->store, &iter, XFMPC_DBBROWSER_COLUMNS_COLUMN_WEIGHT, _tmp1_, -1, -1);
} while (gtk_tree_model_iter_next (model, &iter));
(model == NULL) ? NULL : (model = (g_object_unref (model), NULL));
filename = (g_free (filename), NULL);
@@ -479,15 +479,15 @@
switch ((*event).keyval) {
case 0xff0d:
{
- GtkTreeSelection* _tmp1;
+ GtkTreeSelection* _tmp1_;
GtkTreeSelection* selection;
- _tmp1 = NULL;
- selection = (_tmp1 = gtk_tree_view_get_selection (self->priv->treeview), (_tmp1 == NULL) ? NULL : g_object_ref (_tmp1));
+ _tmp1_ = NULL;
+ selection = (_tmp1_ = gtk_tree_view_get_selection (self->priv->treeview), (_tmp1_ == NULL) ? NULL : g_object_ref (_tmp1_));
if (gtk_tree_selection_count_selected_rows (selection) > 1) {
xfmpc_dbbrowser_add_selected_rows (self);
} else {
- gboolean _tmp2;
- return (_tmp2 = FALSE, (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp2);
+ gboolean _tmp2_;
+ return (_tmp2_ = FALSE, (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp2_);
}
(selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL));
break;
@@ -511,48 +511,48 @@
static gboolean xfmpc_dbbrowser_cb_button_released (XfmpcDbbrowser* self, const GdkEventButton* event) {
- gboolean _tmp0;
+ gboolean _tmp0_;
GtkTreePath* path;
- GtkTreeSelection* _tmp2;
+ GtkTreeSelection* _tmp2_;
GtkTreeSelection* selection;
- GtkTreePath* _tmp6;
- gboolean _tmp5;
- GtkTreePath* _tmp4;
- gboolean _tmp7;
+ GtkTreePath* _tmp6_;
+ gboolean _tmp5_;
+ GtkTreePath* _tmp4_;
+ gboolean _tmp7_;
g_return_val_if_fail (self != NULL, FALSE);
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
if ((*event).type != GDK_BUTTON_PRESS) {
- _tmp0 = TRUE;
+ _tmp0_ = TRUE;
} else {
- _tmp0 = (*event).button != 3;
+ _tmp0_ = (*event).button != 3;
}
- if (_tmp0) {
+ if (_tmp0_) {
return FALSE;
}
path = NULL;
- _tmp2 = NULL;
- selection = (_tmp2 = gtk_tree_view_get_selection (self->priv->treeview), (_tmp2 == NULL) ? NULL : g_object_ref (_tmp2));
+ _tmp2_ = NULL;
+ selection = (_tmp2_ = gtk_tree_view_get_selection (self->priv->treeview), (_tmp2_ == NULL) ? NULL : g_object_ref (_tmp2_));
if (gtk_tree_selection_count_selected_rows (selection) < 1) {
- gboolean _tmp3;
- return (_tmp3 = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp3);
+ gboolean _tmp3_;
+ return (_tmp3_ = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp3_);
}
- _tmp6 = NULL;
- _tmp4 = NULL;
- if ((_tmp5 = gtk_tree_view_get_path_at_pos (self->priv->treeview, (gint) (*event).x, (gint) (*event).y, &_tmp4, NULL, NULL, NULL), path = (_tmp6 = _tmp4, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp6), _tmp5)) {
+ _tmp6_ = NULL;
+ _tmp4_ = NULL;
+ if ((_tmp5_ = gtk_tree_view_get_path_at_pos (self->priv->treeview, (gint) (*event).x, (gint) (*event).y, &_tmp4_, NULL, NULL, NULL), path = (_tmp6_ = _tmp4_, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp6_), _tmp5_)) {
if (!gtk_tree_selection_path_is_selected (selection, path)) {
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_path (selection, path);
}
}
xfmpc_dbbrowser_menu_popup (self);
- return (_tmp7 = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp7);
+ return (_tmp7_ = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp7_);
}
static void xfmpc_dbbrowser_cb_row_activated (XfmpcDbbrowser* self, const GtkTreePath* path, GtkTreeViewColumn* column) {
- const GtkTreePath* _tmp0;
+ const GtkTreePath* _tmp0_;
GtkTreePath* ppath;
- GtkTreeModel* _tmp1;
+ GtkTreeModel* _tmp1_;
GtkTreeModel* model;
GtkTreeIter iter = {0};
char* filename;
@@ -560,10 +560,10 @@
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (column != NULL);
- _tmp0 = NULL;
- ppath = (_tmp0 = path, (_tmp0 == NULL) ? NULL : gtk_tree_path_copy (_tmp0));
- _tmp1 = NULL;
- model = (_tmp1 = (GtkTreeModel*) self->priv->store, (_tmp1 == NULL) ? NULL : g_object_ref (_tmp1));
+ _tmp0_ = NULL;
+ ppath = (_tmp0_ = path, (_tmp0_ == NULL) ? NULL : gtk_tree_path_copy (_tmp0_));
+ _tmp1_ = NULL;
+ model = (_tmp1_ = (GtkTreeModel*) self->priv->store, (_tmp1_ == NULL) ? NULL : g_object_ref (_tmp1_));
filename = g_strdup ("");
is_dir = FALSE;
if (!gtk_tree_model_get_iter (model, &iter, ppath)) {
@@ -594,35 +594,35 @@
static void xfmpc_dbbrowser_cb_browse (XfmpcDbbrowser* self) {
- GtkTreeModel* _tmp0;
+ GtkTreeModel* _tmp0_;
GtkTreeModel* model;
GtkTreeIter iter = {0};
- GtkTreeSelection* _tmp1;
+ GtkTreeSelection* _tmp1_;
GtkTreeSelection* selection;
- GtkTreeModel* _tmp5;
- GtkTreeModel* _tmp4;
- GList* _tmp3;
- GtkTreeModel* _tmp2;
+ GtkTreeModel* _tmp5_;
+ GtkTreeModel* _tmp4_;
+ GList* _tmp3_;
+ GtkTreeModel* _tmp2_;
GList* list;
- const GtkTreePath* _tmp6;
+ const GtkTreePath* _tmp6_;
GtkTreePath* path;
g_return_if_fail (self != NULL);
- _tmp0 = NULL;
- model = (_tmp0 = (GtkTreeModel*) self->priv->store, (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
- _tmp1 = NULL;
- selection = (_tmp1 = gtk_tree_view_get_selection (self->priv->treeview), (_tmp1 == NULL) ? NULL : g_object_ref (_tmp1));
+ _tmp0_ = NULL;
+ model = (_tmp0_ = (GtkTreeModel*) self->priv->store, (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
+ _tmp1_ = NULL;
+ selection = (_tmp1_ = gtk_tree_view_get_selection (self->priv->treeview), (_tmp1_ == NULL) ? NULL : g_object_ref (_tmp1_));
if (gtk_tree_selection_count_selected_rows (selection) > 1) {
(model == NULL) ? NULL : (model = (g_object_unref (model), NULL));
(selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL));
return;
}
- _tmp5 = NULL;
- _tmp4 = NULL;
- _tmp3 = NULL;
- _tmp2 = NULL;
- list = (_tmp3 = gtk_tree_selection_get_selected_rows (selection, &_tmp2), model = (_tmp4 = (_tmp5 = _tmp2, (_tmp5 == NULL) ? NULL : g_object_ref (_tmp5)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp4), _tmp3);
- _tmp6 = NULL;
- path = (_tmp6 = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp6 == NULL) ? NULL : gtk_tree_path_copy (_tmp6));
+ _tmp5_ = NULL;
+ _tmp4_ = NULL;
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ list = (_tmp3_ = gtk_tree_selection_get_selected_rows (selection, &_tmp2_), model = (_tmp4_ = (_tmp5_ = _tmp2_, (_tmp5_ == NULL) ? NULL : g_object_ref (_tmp5_)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp4_), _tmp3_);
+ _tmp6_ = NULL;
+ path = (_tmp6_ = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp6_ == NULL) ? NULL : gtk_tree_path_copy (_tmp6_));
if (gtk_tree_model_get_iter (model, &iter, path)) {
char* filename;
char* dir;
@@ -642,11 +642,11 @@
static void xfmpc_dbbrowser_cb_search_entry_activated (XfmpcDbbrowser* self) {
- const char* _tmp0;
+ const char* _tmp0_;
char* entry_text;
g_return_if_fail (self != NULL);
- _tmp0 = NULL;
- entry_text = (_tmp0 = gtk_entry_get_text (self->priv->search_entry), (_tmp0 == NULL) ? NULL : g_strdup (_tmp0));
+ _tmp0_ = NULL;
+ entry_text = (_tmp0_ = gtk_entry_get_text (self->priv->search_entry), (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_));
if (_vala_strcmp0 (entry_text, "") == 0) {
self->priv->is_searching = FALSE;
xfmpc_dbbrowser_reload (self);
@@ -787,33 +787,33 @@
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = XFMPC_DBBROWSER (obj);
{
- char* _tmp1;
- const char* _tmp0;
- char* _tmp2;
- GtkListStore* _tmp3;
- GtkTreeView* _tmp4;
+ char* _tmp1_;
+ const char* _tmp0_;
+ char* _tmp2_;
+ GtkListStore* _tmp3_;
+ GtkTreeView* _tmp4_;
GtkCellRendererPixbuf* cell_pixbuf;
GtkCellRendererText* cell_text;
GtkScrolledWindow* scrolled;
- GtkMenu* _tmp5;
+ GtkMenu* _tmp5_;
GtkImageMenuItem* mi;
- GtkImageMenuItem* _tmp6;
+ GtkImageMenuItem* _tmp6_;
GtkImage* image;
- GtkImageMenuItem* _tmp7;
- GtkImage* _tmp8;
- GtkEntry* _tmp9;
+ GtkImageMenuItem* _tmp7_;
+ GtkImage* _tmp8_;
+ GtkEntry* _tmp9_;
xfce_textdomain (self->priv->gettext_package, self->priv->localedir, "UTF-8");
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);
- _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);
+ _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_);
+ _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_);
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);
@@ -828,27 +828,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);
+ _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_);
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);
+ _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_);
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);
+ _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_);
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);
+ _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_);
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/extended-interface.c
===================================================================
--- xfmpc/trunk/src/extended-interface.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/extended-interface.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -159,6 +159,7 @@
static GObject * xfmpc_extended_interface_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static gpointer xfmpc_extended_interface_parent_class = NULL;
static void xfmpc_extended_interface_finalize (GObject* obj);
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
@@ -223,7 +224,7 @@
root_x = 0;
root_y = 0;
gtk_widget_size_request ((GtkWidget*) menu, &menu_req);
- gdk_window_get_origin (GTK_WIDGET (xfmpc_extended_interface_context_button)->window, &root_x, &root_y);
+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (xfmpc_extended_interface_context_button)), &root_x, &root_y);
x = root_x + GTK_WIDGET (xfmpc_extended_interface_context_button)->allocation.x;
y = root_y + GTK_WIDGET (xfmpc_extended_interface_context_button)->allocation.y;
if (y > (gdk_screen_height () - menu_req.height)) {
@@ -263,16 +264,16 @@
static void xfmpc_extended_interface_context_menu_new (XfmpcExtendedInterface* self, GtkWidget* attach_widget) {
- GtkMenu* _tmp0;
+ GtkMenu* _tmp0_;
GtkCheckMenuItem* mi;
- GtkCheckMenuItem* _tmp1;
+ GtkCheckMenuItem* _tmp1_;
GtkSeparatorMenuItem* separator;
GtkImageMenuItem* imi;
- GtkImageMenuItem* _tmp2;
+ GtkImageMenuItem* _tmp2_;
g_return_if_fail (self != NULL);
g_return_if_fail (attach_widget != NULL);
- _tmp0 = NULL;
- self->priv->context_menu = (_tmp0 = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), (self->priv->context_menu == NULL) ? NULL : (self->priv->context_menu = (g_object_unref (self->priv->context_menu), NULL)), _tmp0);
+ _tmp0_ = NULL;
+ self->priv->context_menu = (_tmp0_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), (self->priv->context_menu == NULL) ? NULL : (self->priv->context_menu = (g_object_unref (self->priv->context_menu), NULL)), _tmp0_);
gtk_menu_set_screen (self->priv->context_menu, gtk_widget_get_screen (attach_widget));
gtk_menu_attach_to_widget (self->priv->context_menu, attach_widget, (GtkMenuDetachFunc) xfmpc_extended_interface_menu_detach);
g_signal_connect_object ((GtkMenuShell*) self->priv->context_menu, "deactivate", (GCallback) _xfmpc_extended_interface_cb_context_menu_deactivate_gtk_menu_shell_deactivate, self, 0);
@@ -280,8 +281,8 @@
gtk_check_menu_item_set_active (mi, xfmpc_mpdclient_get_repeat (self->priv->mpdclient));
g_signal_connect_object ((GtkMenuItem*) mi, "activate", (GCallback) _xfmpc_extended_interface_cb_repeat_switch_gtk_menu_item_activate, self, 0);
gtk_menu_shell_append ((GtkMenuShell*) self->priv->context_menu, (GtkWidget*) ((GtkMenuItem*) mi));
- _tmp1 = NULL;
- mi = (_tmp1 = g_object_ref_sink ((GtkCheckMenuItem*) gtk_check_menu_item_new_with_label (_ ("Random"))), (mi == NULL) ? NULL : (mi = (g_object_unref (mi), NULL)), _tmp1);
+ _tmp1_ = NULL;
+ mi = (_tmp1_ = g_object_ref_sink ((GtkCheckMenuItem*) gtk_check_menu_item_new_with_label (_ ("Random"))), (mi == NULL) ? NULL : (mi = (g_object_unref (mi), NULL)), _tmp1_);
gtk_check_menu_item_set_active (mi, xfmpc_mpdclient_get_random (self->priv->mpdclient));
g_signal_connect_object ((GtkMenuItem*) mi, "activate", (GCallback) _xfmpc_extended_interface_cb_random_switch_gtk_menu_item_activate, self, 0);
gtk_menu_shell_append ((GtkMenuShell*) self->priv->context_menu, (GtkWidget*) ((GtkMenuItem*) mi));
@@ -290,8 +291,8 @@
imi = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_PREFERENCES, NULL));
g_signal_connect_object ((GtkMenuItem*) imi, "activate", (GCallback) _xfmpc_extended_interface_cb_preferences_gtk_menu_item_activate, self, 0);
gtk_menu_shell_append ((GtkMenuShell*) self->priv->context_menu, (GtkWidget*) ((GtkMenuItem*) imi));
- _tmp2 = NULL;
- imi = (_tmp2 = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL)), (imi == NULL) ? NULL : (imi = (g_object_unref (imi), NULL)), _tmp2);
+ _tmp2_ = NULL;
+ imi = (_tmp2_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL)), (imi == NULL) ? NULL : (imi = (g_object_unref (imi), NULL)), _tmp2_);
g_signal_connect_object ((GtkMenuItem*) imi, "activate", (GCallback) _xfmpc_extended_interface_cb_about_gtk_menu_item_activate, self, 0);
gtk_menu_shell_append ((GtkMenuShell*) self->priv->context_menu, (GtkWidget*) ((GtkMenuItem*) imi));
gtk_widget_show_all ((GtkWidget*) self->priv->context_menu);
@@ -376,31 +377,31 @@
static void xfmpc_extended_interface_cb_about (XfmpcExtendedInterface* self) {
- char** _tmp1;
+ char** _tmp1_;
gint artists_size;
gint artists_length1;
- char** _tmp0;
+ char** _tmp0_;
char** artists;
- char** _tmp3;
+ char** _tmp3_;
gint authors_size;
gint authors_length1;
- char** _tmp2;
+ char** _tmp2_;
char** authors;
- char** _tmp5;
+ char** _tmp5_;
gint documenters_size;
gint documenters_length1;
- char** _tmp4;
+ char** _tmp4_;
char** documenters;
g_return_if_fail (self != NULL);
- _tmp1 = NULL;
- _tmp0 = NULL;
- artists = (_tmp1 = (_tmp0 = g_new0 (char*, 1 + 1), _tmp0[0] = NULL, _tmp0), artists_length1 = 1, artists_size = artists_length1, _tmp1);
- _tmp3 = NULL;
- _tmp2 = NULL;
- authors = (_tmp3 = (_tmp2 = g_new0 (char*, 2 + 1), _tmp2[0] = g_strdup ("Mike Massonnet <mmassonnet at xfce.org>"), _tmp2[1] = g_strdup ("Vincent Legout <vincent at xfce.org>"), _tmp2), authors_length1 = 2, authors_size = authors_length1, _tmp3);
- _tmp5 = NULL;
- _tmp4 = NULL;
- documenters = (_tmp5 = (_tmp4 = g_new0 (char*, 1 + 1), _tmp4[0] = NULL, _tmp4), documenters_length1 = 1, documenters_size = documenters_length1, _tmp5);
+ _tmp1_ = NULL;
+ _tmp0_ = NULL;
+ artists = (_tmp1_ = (_tmp0_ = g_new0 (char*, 1 + 1), _tmp0_[0] = NULL, _tmp0_), artists_length1 = 1, artists_size = artists_length1, _tmp1_);
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ authors = (_tmp3_ = (_tmp2_ = g_new0 (char*, 2 + 1), _tmp2_[0] = g_strdup ("Mike Massonnet <mmassonnet at xfce.org>"), _tmp2_[1] = g_strdup ("Vincent Legout <vincent at xfce.org>"), _tmp2_), authors_length1 = 2, authors_size = authors_length1, _tmp3_);
+ _tmp5_ = NULL;
+ _tmp4_ = NULL;
+ documenters = (_tmp5_ = (_tmp4_ = g_new0 (char*, 1 + 1), _tmp4_[0] = NULL, _tmp4_), documenters_length1 = 1, documenters_size = documenters_length1, _tmp5_);
gtk_show_about_dialog (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))), "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_LICENSE_TEXT_GPL), "translator-credits", _ ("translator-credits"), "version", PACKAGE_VERSION, "website", "http://goodies.xfce.org/projects/applications/xfmpc", NULL, NULL);
artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
@@ -458,13 +459,13 @@
GtkHBox* hbox;
GtkButton* button;
GtkImage* image;
- GtkButton* _tmp0;
- GtkImage* _tmp1;
- XfceArrowButton* _tmp2;
- GtkListStore* _tmp3;
- GtkComboBox* _tmp4;
+ GtkButton* _tmp0_;
+ GtkImage* _tmp1_;
+ XfceArrowButton* _tmp2_;
+ GtkListStore* _tmp3_;
+ GtkComboBox* _tmp4_;
GtkCellRendererText* cell;
- GtkNotebook* _tmp5;
+ GtkNotebook* _tmp5_;
GtkWidget* playlist;
GtkWidget* dbbrowser;
xfce_textdomain (self->priv->gettext_package, self->priv->localedir, "UTF-8");
@@ -478,31 +479,31 @@
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) button, FALSE, FALSE, (guint) 0);
image = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_NEW, GTK_ICON_SIZE_MENU));
gtk_button_set_image (button, (GtkWidget*) image);
- _tmp0 = NULL;
- button = (_tmp0 = g_object_ref_sink ((GtkButton*) gtk_button_new ()), (button == NULL) ? NULL : (button = (g_object_unref (button), NULL)), _tmp0);
+ _tmp0_ = NULL;
+ button = (_tmp0_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), (button == NULL) ? NULL : (button = (g_object_unref (button), NULL)), _tmp0_);
gtk_widget_set_tooltip_text ((GtkWidget*) button, _ ("Refresh Database"));
g_signal_connect_object (button, "clicked", (GCallback) _xfmpc_extended_interface_cb_database_refresh_gtk_button_clicked, self, 0);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) button, FALSE, FALSE, (guint) 0);
- _tmp1 = NULL;
- image = (_tmp1 = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU)), (image == NULL) ? NULL : (image = (g_object_unref (image), NULL)), _tmp1);
+ _tmp1_ = NULL;
+ image = (_tmp1_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU)), (image == NULL) ? NULL : (image = (g_object_unref (image), NULL)), _tmp1_);
gtk_button_set_image (button, (GtkWidget*) image);
- _tmp2 = NULL;
- xfmpc_extended_interface_context_button = (_tmp2 = (XfceArrowButton*) xfce_arrow_button_new (GTK_ARROW_DOWN), (xfmpc_extended_interface_context_button == NULL) ? NULL : (xfmpc_extended_interface_context_button = ( (xfmpc_extended_interface_context_button), NULL)), _tmp2);
+ _tmp2_ = NULL;
+ xfmpc_extended_interface_context_button = (_tmp2_ = (XfceArrowButton*) xfce_arrow_button_new (GTK_ARROW_DOWN), (xfmpc_extended_interface_context_button == NULL) ? NULL : (xfmpc_extended_interface_context_button = ( (xfmpc_extended_interface_context_button), NULL)), _tmp2_);
gtk_widget_set_tooltip_text (GTK_WIDGET (xfmpc_extended_interface_context_button), _ ("Context Menu"));
g_signal_connect_object (GTK_BUTTON (xfmpc_extended_interface_context_button), "pressed", (GCallback) _xfmpc_extended_interface_popup_context_menu_gtk_button_pressed, self, 0);
g_signal_connect_object (GTK_BUTTON (xfmpc_extended_interface_context_button), "clicked", (GCallback) _xfmpc_extended_interface_cb_context_menu_clicked_gtk_button_clicked, self, 0);
gtk_box_pack_start ((GtkBox*) hbox, GTK_WIDGET (xfmpc_extended_interface_context_button), FALSE, FALSE, (guint) 0);
- _tmp3 = NULL;
- self->priv->list_store = (_tmp3 = gtk_list_store_new ((gint) XFMPC_EXTENDED_INTERFACE_COLUMNS_N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER, NULL), (self->priv->list_store == NULL) ? NULL : (self->priv->list_store = (g_object_unref (self->priv->list_store), NULL)), _tmp3);
- _tmp4 = NULL;
- self->priv->combobox = (_tmp4 = g_object_ref_sink ((GtkComboBox*) gtk_combo_box_new_with_model ((GtkTreeModel*) self->priv->list_store)), (self->priv->combobox == NULL) ? NULL : (self->priv->combobox = (g_object_unref (self->priv->combobox), NULL)), _tmp4);
+ _tmp3_ = NULL;
+ self->priv->list_store = (_tmp3_ = gtk_list_store_new ((gint) XFMPC_EXTENDED_INTERFACE_COLUMNS_N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER, NULL), (self->priv->list_store == NULL) ? NULL : (self->priv->list_store = (g_object_unref (self->priv->list_store), NULL)), _tmp3_);
+ _tmp4_ = NULL;
+ self->priv->combobox = (_tmp4_ = g_object_ref_sink ((GtkComboBox*) gtk_combo_box_new_with_model ((GtkTreeModel*) self->priv->list_store)), (self->priv->combobox == NULL) ? NULL : (self->priv->combobox = (g_object_unref (self->priv->combobox), NULL)), _tmp4_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) self->priv->combobox, TRUE, TRUE, (guint) 0);
g_signal_connect_object (self->priv->combobox, "changed", (GCallback) _xfmpc_extended_interface_cb_interface_changed_gtk_combo_box_changed, self, 0);
cell = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ());
gtk_cell_layout_pack_start ((GtkCellLayout*) self->priv->combobox, (GtkCellRenderer*) cell, TRUE);
gtk_cell_layout_set_attributes ((GtkCellLayout*) self->priv->combobox, (GtkCellRenderer*) cell, "text", XFMPC_EXTENDED_INTERFACE_COLUMNS_COLUMN_STRING, NULL, NULL);
- _tmp5 = NULL;
- self->priv->notebook = (_tmp5 = g_object_ref_sink ((GtkNotebook*) gtk_notebook_new ()), (self->priv->notebook == NULL) ? NULL : (self->priv->notebook = (g_object_unref (self->priv->notebook), NULL)), _tmp5);
+ _tmp5_ = NULL;
+ self->priv->notebook = (_tmp5_ = g_object_ref_sink ((GtkNotebook*) gtk_notebook_new ()), (self->priv->notebook == NULL) ? NULL : (self->priv->notebook = (g_object_unref (self->priv->notebook), NULL)), _tmp5_);
gtk_notebook_set_show_tabs (self->priv->notebook, FALSE);
gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) self->priv->notebook, TRUE, TRUE, (guint) 0);
playlist = GTK_WIDGET (g_object_ref_sink (xfmpc_playlist_new ()));
@@ -560,7 +561,7 @@
}
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
for (i = 0; i < array_length; i = i + 1) {
@@ -569,6 +570,11 @@
}
}
}
+}
+
+
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ _vala_array_destroy (array, array_length, destroy_func);
g_free (array);
}
Modified: xfmpc/trunk/src/interface.c
===================================================================
--- xfmpc/trunk/src/interface.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/interface.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2008-2009 Mike Massonnet <mmassonnet at xfce.org>
+ * 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
@@ -16,440 +17,553 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifdef HAVE_CONFIG_H
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <mpdclient.h>
+#include <preferences.h>
+#include <stdlib.h>
+#include <string.h>
#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <gdk/gdk.h>
+#include <float.h>
+#include <math.h>
+#include <glib/gi18n-lib.h>
#include <libxfce4util/libxfce4util.h>
+#include <pango/pango.h>
-#include "interface.h"
-#include "preferences.h"
-#include "mpdclient.h"
-#define BORDER 4
+#define XFMPC_TYPE_INTERFACE (xfmpc_interface_get_type ())
+#define XFMPC_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_INTERFACE, XfmpcInterface))
+#define XFMPC_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_INTERFACE, XfmpcInterfaceClass))
+#define XFMPC_IS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFMPC_TYPE_INTERFACE))
+#define XFMPC_IS_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFMPC_TYPE_INTERFACE))
+#define XFMPC_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFMPC_TYPE_INTERFACE, XfmpcInterfaceClass))
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFMPC_TYPE_INTERFACE, XfmpcInterfacePrivate))
+typedef struct _XfmpcInterface XfmpcInterface;
+typedef struct _XfmpcInterfaceClass XfmpcInterfaceClass;
+typedef struct _XfmpcInterfacePrivate XfmpcInterfacePrivate;
+struct _XfmpcInterface {
+ GtkVBox parent_instance;
+ XfmpcInterfacePrivate * priv;
+};
+struct _XfmpcInterfaceClass {
+ GtkVBoxClass parent_class;
+};
-static void xfmpc_interface_class_init (XfmpcInterfaceClass *klass);
-static void xfmpc_interface_init (XfmpcInterface *interface);
-static void xfmpc_interface_dispose (GObject *object);
-static void xfmpc_interface_finalize (GObject *object);
+struct _XfmpcInterfacePrivate {
+ XfmpcMpdclient* mpdclient;
+ XfmpcPreferences* preferences;
+ char* gettext_package;
+ char* localedir;
+ GtkButton* button_prev;
+ GtkButton* button_pp;
+ GtkButton* button_next;
+ GtkVolumeButton* button_volume;
+ GtkProgressBar* progress_bar;
+ GtkLabel* title;
+ GtkLabel* subtitle;
+ gboolean refresh_title;
+};
-static gboolean xfmpc_interface_refresh (XfmpcInterface *interface);
-static gboolean xfmpc_interface_reconnect (XfmpcInterface *interface);
-static void cb_song_changed (XfmpcInterface *interface);
+GType xfmpc_interface_get_type (void);
+#define XFMPC_INTERFACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFMPC_TYPE_INTERFACE, XfmpcInterfacePrivate))
+enum {
+ XFMPC_INTERFACE_DUMMY_PROPERTY
+};
+void xfmpc_interface_set_title (XfmpcInterface* self, const char* title);
+void xfmpc_interface_set_subtitle (XfmpcInterface* self, const char* subtitle);
+void xfmpc_interface_set_pp (XfmpcInterface* self, gboolean play);
+void xfmpc_interface_pp_clicked (XfmpcInterface* self);
+static gboolean xfmpc_interface_cb_progress_box_release_event (XfmpcInterface* self, const GdkEventButton* event);
+void xfmpc_interface_volume_changed (XfmpcInterface* self, double value);
+void xfmpc_interface_set_volume (XfmpcInterface* self, gint volume);
+void xfmpc_interface_popup_volume (XfmpcInterface* self);
+void xfmpc_interface_set_time (XfmpcInterface* self, gint time, gint time_total);
+static void xfmpc_interface_reconnect (XfmpcInterface* self);
+static gboolean xfmpc_interface_refresh (XfmpcInterface* self);
+static void xfmpc_interface_cb_song_changed (XfmpcInterface* self);
+static void xfmpc_interface_cb_stopped (XfmpcInterface* self);
+static gboolean _xfmpc_interface_refresh_gsource_func (gpointer self);
+static void xfmpc_interface_cb_pp_changed (XfmpcInterface* self, gboolean is_playing);
+static void xfmpc_interface_cb_time_changed (XfmpcInterface* self, gint time, gint total_time);
+static void xfmpc_interface_cb_volume_changed (XfmpcInterface* self, gint volume);
+static void xfmpc_interface_cb_mpdclient_previous (XfmpcInterface* self);
+static void xfmpc_interface_cb_mpdclient_next (XfmpcInterface* self);
+XfmpcInterface* xfmpc_interface_new (void);
+XfmpcInterface* xfmpc_interface_construct (GType object_type);
+XfmpcInterface* xfmpc_interface_new (void);
+static void _xfmpc_interface_cb_mpdclient_previous_gtk_button_clicked (GtkButton* _sender, gpointer self);
+static void _xfmpc_interface_pp_clicked_gtk_button_clicked (GtkButton* _sender, gpointer self);
+static void _xfmpc_interface_cb_mpdclient_next_gtk_button_clicked (GtkButton* _sender, gpointer self);
+static void _xfmpc_interface_volume_changed_gtk_scale_button_value_changed (GtkVolumeButton* _sender, double value, gpointer self);
+static gboolean _xfmpc_interface_cb_progress_box_release_event_gtk_widget_button_release_event (GtkEventBox* _sender, const GdkEventButton* event, gpointer self);
+static void _xfmpc_interface_reconnect_xfmpc_mpdclient_connected (XfmpcMpdclient* _sender, gpointer self);
+static void _xfmpc_interface_cb_song_changed_xfmpc_mpdclient_song_changed (XfmpcMpdclient* _sender, gpointer self);
+static void _xfmpc_interface_cb_pp_changed_xfmpc_mpdclient_pp_changed (XfmpcMpdclient* _sender, gboolean is_playing, gpointer self);
+static void _xfmpc_interface_cb_time_changed_xfmpc_mpdclient_time_changed (XfmpcMpdclient* _sender, gint time, gint total_time, gpointer self);
+static void _xfmpc_interface_cb_volume_changed_xfmpc_mpdclient_volume_changed (XfmpcMpdclient* _sender, gint volume, gpointer self);
+static void _xfmpc_interface_cb_stopped_xfmpc_mpdclient_stopped (XfmpcMpdclient* _sender, gpointer self);
+static GObject * xfmpc_interface_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+static gpointer xfmpc_interface_parent_class = NULL;
+static void xfmpc_interface_finalize (GObject* obj);
-static void cb_pp_changed (XfmpcInterface *interface,
- gboolean is_playing);
-static gboolean cb_progress_box_release_event (XfmpcInterface *interface,
- GdkEventButton *event);
-static void cb_time_changed (XfmpcInterface *interface,
- gint time,
- gint total_time);
-static void cb_volume_changed (XfmpcInterface *interface,
- gint volume);
-static void cb_stopped (XfmpcInterface *interface);
+void xfmpc_interface_set_title (XfmpcInterface* self, const char* title) {
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (title != NULL);
+ gtk_label_set_text (self->priv->title, title);
+}
-static GObjectClass *parent_class = NULL;
+void xfmpc_interface_set_subtitle (XfmpcInterface* self, const char* subtitle) {
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (subtitle != NULL);
+ gtk_label_set_text (self->priv->subtitle, subtitle);
+}
-GType
-xfmpc_interface_get_type ()
-{
- static GType xfmpc_interface_type = G_TYPE_INVALID;
+void xfmpc_interface_pp_clicked (XfmpcInterface* self) {
+ g_return_if_fail (self != NULL);
+ if (!xfmpc_mpdclient_pp (self->priv->mpdclient)) {
+ return;
+ }
+ xfmpc_interface_set_pp (self, xfmpc_mpdclient_is_playing (self->priv->mpdclient));
+}
- if (G_UNLIKELY (xfmpc_interface_type == G_TYPE_INVALID))
- {
- static const GTypeInfo xfmpc_interface_info =
- {
- sizeof (XfmpcInterfaceClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) xfmpc_interface_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (XfmpcInterface),
- 0,
- (GInstanceInitFunc) xfmpc_interface_init,
- NULL
- };
- xfmpc_interface_type = g_type_register_static (GTK_TYPE_VBOX, "XfmpcInterface", &xfmpc_interface_info, 0);
- }
- return xfmpc_interface_type;
+void xfmpc_interface_set_pp (XfmpcInterface* self, gboolean play) {
+ GtkImage* _tmp0_;
+ GtkImage* image;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = NULL;
+ image = (_tmp0_ = GTK_IMAGE (gtk_bin_get_child ((GtkBin*) self->priv->button_pp)), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
+ if (play == TRUE) {
+ gtk_image_set_from_stock (image, GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_BUTTON);
+ } else {
+ gtk_image_set_from_stock (image, GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON);
+ }
+ (image == NULL) ? NULL : (image = (g_object_unref (image), NULL));
}
+static gboolean xfmpc_interface_cb_progress_box_release_event (XfmpcInterface* self, const GdkEventButton* event) {
+ gboolean _tmp0_;
+ gint time_total;
+ double time;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = FALSE;
+ if ((*event).type != GDK_BUTTON_RELEASE) {
+ _tmp0_ = TRUE;
+ } else {
+ _tmp0_ = (*event).button != 1;
+ }
+ if (_tmp0_) {
+ return FALSE;
+ }
+ time_total = xfmpc_mpdclient_get_total_time (self->priv->mpdclient);
+ if (time_total < 0) {
+ return FALSE;
+ }
+ time = (*event).x / ((GtkWidget*) self->priv->progress_bar)->allocation.width;
+ time = time * ((double) time_total);
+ xfmpc_mpdclient_set_song_time (self->priv->mpdclient, (guint) ((gint) time));
+ return TRUE;
+}
-static void
-xfmpc_interface_class_init (XfmpcInterfaceClass *klass)
-{
- GObjectClass *gobject_class;
- g_type_class_add_private (klass, sizeof (XfmpcInterfacePrivate));
+void xfmpc_interface_volume_changed (XfmpcInterface* self, double value) {
+ g_return_if_fail (self != NULL);
+ xfmpc_mpdclient_set_volume (self->priv->mpdclient, (guchar) ((gchar) value));
+}
- parent_class = g_type_class_peek_parent (klass);
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->dispose = xfmpc_interface_dispose;
- gobject_class->finalize = xfmpc_interface_finalize;
+void xfmpc_interface_set_volume (XfmpcInterface* self, gint volume) {
+ g_return_if_fail (self != NULL);
+ gtk_scale_button_set_value ((GtkScaleButton*) self->priv->button_volume, (double) volume);
}
-static void
-xfmpc_interface_init (XfmpcInterface *interface)
-{
- XfmpcInterfacePrivate *priv = interface->priv = GET_PRIVATE (interface);
- gtk_container_set_border_width (GTK_CONTAINER (interface), BORDER);
- interface->preferences = xfmpc_preferences_get ();
- interface->mpdclient = xfmpc_mpdclient_get ();
+void xfmpc_interface_popup_volume (XfmpcInterface* self) {
+ g_return_if_fail (self != NULL);
+ g_signal_emit_by_name (self->priv->button_volume, "popup", NULL, NULL);
+}
- /* === Interface widgets === */
- GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PREVIOUS, GTK_ICON_SIZE_BUTTON);
- GtkWidget *control = priv->button_prev = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (control), GTK_RELIEF_NONE);
- gtk_container_add (GTK_CONTAINER (control), image);
- image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON);
- control = priv->button_pp = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (control), GTK_RELIEF_NONE);
- gtk_container_add (GTK_CONTAINER (control), image);
+void xfmpc_interface_set_time (XfmpcInterface* self, gint time, gint time_total) {
+ gint min;
+ gint sec;
+ gint min_total;
+ gint sec_total;
+ double fraction;
+ GString* text;
+ double _tmp0_;
+ g_return_if_fail (self != NULL);
+ min = 0;
+ sec = 0;
+ min_total = 0;
+ sec_total = 0;
+ fraction = 1.0;
+ min = time / 60;
+ sec = time % 60;
+ min_total = time_total / 60;
+ sec_total = time_total % 60;
+ text = g_string_new ("");
+ g_string_append_printf (text, "%d:%02d / %d:%02d", min, sec, min_total, sec_total);
+ gtk_progress_bar_set_text (self->priv->progress_bar, text->str);
+ if (time_total > 0) {
+ fraction = (double) (((float) time) / ((float) time_total));
+ }
+ _tmp0_ = 0.0;
+ if (fraction <= 1.0) {
+ _tmp0_ = fraction;
+ } else {
+ _tmp0_ = 1.0;
+ }
+ gtk_progress_bar_set_fraction (self->priv->progress_bar, _tmp0_);
+ (text == NULL) ? NULL : (text = (g_string_free (text, TRUE), NULL));
+}
- image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_NEXT, GTK_ICON_SIZE_BUTTON);
- control = priv->button_next = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (control), GTK_RELIEF_NONE);
- gtk_container_add (GTK_CONTAINER (control), image);
- control = priv->button_volume = gtk_volume_button_new ();
- gtk_button_set_relief (GTK_BUTTON (control), GTK_RELIEF_NONE);
- GtkAdjustment* adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (control));
- adjustment->upper *= 100;
- adjustment->step_increment *= 100;
- adjustment->page_increment *= 100;
+static gboolean xfmpc_interface_refresh (XfmpcInterface* self) {
+ g_return_val_if_fail (self != NULL, FALSE);
+ if (xfmpc_mpdclient_connect (self->priv->mpdclient) == FALSE) {
+ g_warning ("interface.vala:213: Failed to connect to MPD");
+ xfmpc_mpdclient_disconnect (self->priv->mpdclient);
+ xfmpc_interface_set_pp (self, FALSE);
+ xfmpc_interface_set_time (self, 0, 0);
+ xfmpc_interface_set_volume (self, 0);
+ xfmpc_interface_set_title (self, _ ("Not connected"));
+ xfmpc_interface_set_subtitle (self, PACKAGE_STRING);
+ g_timeout_add ((guint) 15000, (GSourceFunc) xfmpc_interface_reconnect, NULL);
+ return FALSE;
+ }
+ xfmpc_mpdclient_update_status (self->priv->mpdclient);
+ return TRUE;
+}
- GtkWidget *progress_box = gtk_event_box_new ();
- control = priv->progress_bar = gtk_progress_bar_new ();
- gtk_progress_bar_set_text (GTK_PROGRESS_BAR (control), "0:00 / 0:00");
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (control), 1.0);
- gtk_container_add (GTK_CONTAINER (progress_box), control);
- /* Title */
- PangoAttrList* attrs = pango_attr_list_new ();
- PangoAttribute* attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
- attr->start_index = 0;
- attr->end_index = -1;
- pango_attr_list_insert (attrs, attr);
+static gboolean _xfmpc_interface_refresh_gsource_func (gpointer self) {
+ return xfmpc_interface_refresh (self);
+}
- attr = pango_attr_scale_new (PANGO_SCALE_X_LARGE);
- attr->start_index = 0;
- attr->end_index = -1;
- pango_attr_list_insert (attrs, attr);
- GtkWidget *label = priv->title = gtk_label_new (_("Not connected"));
- gtk_label_set_attributes (GTK_LABEL (label), attrs);
- gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+static void xfmpc_interface_reconnect (XfmpcInterface* self) {
+ g_return_if_fail (self != NULL);
+ if (xfmpc_mpdclient_connect (self->priv->mpdclient) == FALSE) {
+ return;
+ }
+ /* Refresh title/subtitle (bug #4975) */
+ self->priv->refresh_title = TRUE;
+ if (xfmpc_mpdclient_is_playing (self->priv->mpdclient)) {
+ xfmpc_interface_cb_song_changed (self);
+ } else {
+ xfmpc_interface_cb_stopped (self);
+ }
+ /* Return FALSE to kill the reconnection timeout and start a refresh timeout */
+ g_timeout_add ((guint) 1000, _xfmpc_interface_refresh_gsource_func, self);
+}
- /* Subtitle */
- attrs = pango_attr_list_new ();
- attr = pango_attr_scale_new (PANGO_SCALE_SMALL);
- attr->start_index = 0;
- attr->end_index = -1;
- pango_attr_list_insert (attrs, attr);
- label = priv->subtitle = gtk_label_new (PACKAGE_STRING);
- gtk_label_set_attributes (GTK_LABEL (label), attrs);
- gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+static void xfmpc_interface_cb_song_changed (XfmpcInterface* self) {
+ GString* text;
+ g_return_if_fail (self != NULL);
+ /* title */
+ xfmpc_interface_set_title (self, xfmpc_mpdclient_get_title (self->priv->mpdclient));
+ /* subtitle "by \"artist\" from \"album\" (year)" */
+ text = g_string_new ("");
+ g_string_append_printf (text, _ ("by \"%s\" from \"%s\" (%s)"), xfmpc_mpdclient_get_artist (self->priv->mpdclient), xfmpc_mpdclient_get_album (self->priv->mpdclient), xfmpc_mpdclient_get_date (self->priv->mpdclient));
+ /* text = xfmpc_interface_get_subtitle (interface); to avoid "n/a" values, so far I don't care */
+ xfmpc_interface_set_subtitle (self, text->str);
+ (text == NULL) ? NULL : (text = (g_string_free (text, TRUE), NULL));
+}
- /* === Containers === */
- GtkWidget *box = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (interface), box, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), priv->button_prev, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), priv->button_pp, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), priv->button_next, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), progress_box, TRUE, TRUE, BORDER);
- gtk_box_pack_start (GTK_BOX (box), priv->button_volume, FALSE, FALSE, 0);
- box = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (interface), box, FALSE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER (box), priv->title);
- gtk_container_add (GTK_CONTAINER (box), priv->subtitle);
+static void xfmpc_interface_cb_pp_changed (XfmpcInterface* self, gboolean is_playing) {
+ g_return_if_fail (self != NULL);
+ xfmpc_interface_set_pp (self, is_playing);
+ if (self->priv->refresh_title) {
+ xfmpc_interface_cb_song_changed (self);
+ self->priv->refresh_title = FALSE;
+ }
+}
- /* === Signals === */
- g_signal_connect_swapped (priv->button_prev, "clicked",
- G_CALLBACK (xfmpc_mpdclient_previous), interface->mpdclient);
- g_signal_connect_swapped (priv->button_pp, "clicked",
- G_CALLBACK (xfmpc_interface_pp_clicked), interface);
- g_signal_connect_swapped (priv->button_next, "clicked",
- G_CALLBACK (xfmpc_mpdclient_next), interface->mpdclient);
- g_signal_connect_swapped (priv->button_volume, "value-changed",
- G_CALLBACK (xfmpc_interface_volume_changed), interface);
- g_signal_connect_swapped (progress_box, "button-release-event",
- G_CALLBACK (cb_progress_box_release_event), interface);
- g_signal_connect_swapped (interface->mpdclient, "connected",
- G_CALLBACK (xfmpc_interface_reconnect), interface);
- g_signal_connect_swapped (interface->mpdclient, "song-changed",
- G_CALLBACK (cb_song_changed), interface);
- g_signal_connect_swapped (interface->mpdclient, "pp-changed",
- G_CALLBACK (cb_pp_changed), interface);
- g_signal_connect_swapped (interface->mpdclient, "time-changed",
- G_CALLBACK (cb_time_changed), interface);
- g_signal_connect_swapped (interface->mpdclient, "volume-changed",
- G_CALLBACK (cb_volume_changed), interface);
- g_signal_connect_swapped (interface->mpdclient, "stopped",
- G_CALLBACK (cb_stopped), interface);
-
- /* === Timeout === */
- g_timeout_add (1000, (GSourceFunc)xfmpc_interface_refresh, interface);
+static void xfmpc_interface_cb_time_changed (XfmpcInterface* self, gint time, gint total_time) {
+ g_return_if_fail (self != NULL);
+ xfmpc_interface_set_time (self, time, total_time);
}
-static void
-xfmpc_interface_dispose (GObject *object)
-{
- (*G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-static void
-xfmpc_interface_finalize (GObject *object)
-{
- XfmpcInterface *interface = XFMPC_INTERFACE (object);
- g_object_unref (G_OBJECT (interface->preferences));
- g_object_unref (G_OBJECT (interface->mpdclient));
- (*G_OBJECT_CLASS (parent_class)->finalize) (object);
+static void xfmpc_interface_cb_volume_changed (XfmpcInterface* self, gint volume) {
+ g_return_if_fail (self != NULL);
+ xfmpc_interface_set_volume (self, volume);
}
-
-GtkWidget*
-xfmpc_interface_new ()
-{
- return g_object_new (XFMPC_TYPE_INTERFACE,
- "spacing", BORDER, NULL);
+static void xfmpc_interface_cb_stopped (XfmpcInterface* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_interface_set_pp (self, FALSE);
+ xfmpc_interface_set_time (self, 0, 0);
+ xfmpc_interface_set_title (self, _ ("Stopped"));
+ xfmpc_interface_set_subtitle (self, PACKAGE_STRING);
+ self->priv->refresh_title = TRUE;
}
-void
-xfmpc_interface_set_title (XfmpcInterface *interface,
- const gchar *title)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- gtk_label_set_text (GTK_LABEL (priv->title), title);
+static void xfmpc_interface_cb_mpdclient_previous (XfmpcInterface* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_mpdclient_previous (self->priv->mpdclient);
}
-void
-xfmpc_interface_set_subtitle (XfmpcInterface *interface,
- const gchar *subtitle)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- gtk_label_set_text (GTK_LABEL (priv->subtitle), subtitle);
+static void xfmpc_interface_cb_mpdclient_next (XfmpcInterface* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_mpdclient_next (self->priv->mpdclient);
}
-void
-xfmpc_interface_pp_clicked (XfmpcInterface *interface)
-{
- if (G_UNLIKELY (!xfmpc_mpdclient_pp (interface->mpdclient)))
- return;
- xfmpc_interface_set_pp (interface, xfmpc_mpdclient_is_playing (interface->mpdclient));
+
+XfmpcInterface* xfmpc_interface_construct (GType object_type) {
+ XfmpcInterface * self;
+ self = g_object_newv (object_type, 0, NULL);
+ return self;
}
-void
-xfmpc_interface_set_pp (XfmpcInterface *interface,
- gboolean play)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- GtkWidget *image = gtk_bin_get_child (GTK_BIN (priv->button_pp));
-
- if (play == TRUE)
- gtk_image_set_from_stock (GTK_IMAGE (image), GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_BUTTON);
- else
- gtk_image_set_from_stock (GTK_IMAGE (image), GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON);
+XfmpcInterface* xfmpc_interface_new (void) {
+ return xfmpc_interface_construct (XFMPC_TYPE_INTERFACE);
}
-static gboolean
-cb_progress_box_release_event (XfmpcInterface *interface,
- GdkEventButton *event)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- if (G_UNLIKELY (event->type != GDK_BUTTON_RELEASE || event->button != 1))
- return FALSE;
+static void _xfmpc_interface_cb_mpdclient_previous_gtk_button_clicked (GtkButton* _sender, gpointer self) {
+ xfmpc_interface_cb_mpdclient_previous (self);
+}
- gint time_total = xfmpc_mpdclient_get_total_time (interface->mpdclient);
- if (G_UNLIKELY (time_total < 0))
- return FALSE;
- gdouble time = event->x / priv->progress_bar->allocation.width;
- time *= time_total;
+static void _xfmpc_interface_pp_clicked_gtk_button_clicked (GtkButton* _sender, gpointer self) {
+ xfmpc_interface_pp_clicked (self);
+}
- xfmpc_mpdclient_set_song_time (interface->mpdclient, (guint)time);
- return TRUE;
+static void _xfmpc_interface_cb_mpdclient_next_gtk_button_clicked (GtkButton* _sender, gpointer self) {
+ xfmpc_interface_cb_mpdclient_next (self);
}
-void
-xfmpc_interface_volume_changed (XfmpcInterface *interface,
- gdouble value)
-{
- xfmpc_mpdclient_set_volume (interface->mpdclient, value);
+
+static void _xfmpc_interface_volume_changed_gtk_scale_button_value_changed (GtkVolumeButton* _sender, double value, gpointer self) {
+ xfmpc_interface_volume_changed (self, value);
}
-void
-xfmpc_interface_set_volume (XfmpcInterface *interface,
- guint8 volume)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- gtk_scale_button_set_value (GTK_SCALE_BUTTON (priv->button_volume), volume);
+static gboolean _xfmpc_interface_cb_progress_box_release_event_gtk_widget_button_release_event (GtkEventBox* _sender, const GdkEventButton* event, gpointer self) {
+ return xfmpc_interface_cb_progress_box_release_event (self, event);
}
-void
-xfmpc_interface_popup_volume (XfmpcInterface *interface)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- g_signal_emit_by_name (priv->button_volume, "popup", G_TYPE_NONE);
+static void _xfmpc_interface_reconnect_xfmpc_mpdclient_connected (XfmpcMpdclient* _sender, gpointer self) {
+ xfmpc_interface_reconnect (self);
}
-void
-xfmpc_interface_set_time (XfmpcInterface *interface,
- gint time,
- gint time_total)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- gint min, sec, min_total, sec_total;
- gchar *text;
- gdouble fraction = 1.0;
+static void _xfmpc_interface_cb_song_changed_xfmpc_mpdclient_song_changed (XfmpcMpdclient* _sender, gpointer self) {
+ xfmpc_interface_cb_song_changed (self);
+}
- min = time / 60;
- sec = time % 60;
- min_total = time_total / 60;
- sec_total = time_total % 60;
+static void _xfmpc_interface_cb_pp_changed_xfmpc_mpdclient_pp_changed (XfmpcMpdclient* _sender, gboolean is_playing, gpointer self) {
+ xfmpc_interface_cb_pp_changed (self, is_playing);
+}
- text = g_strdup_printf ("%d:%02d / %d:%02d", min, sec, min_total, sec_total);
- gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress_bar), text);
- g_free (text);
- if (G_LIKELY (time_total > 0))
- fraction = (gfloat)time / (gfloat)time_total;
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar),
- (fraction <= 1.0) ? fraction : 1.0);
+static void _xfmpc_interface_cb_time_changed_xfmpc_mpdclient_time_changed (XfmpcMpdclient* _sender, gint time, gint total_time, gpointer self) {
+ xfmpc_interface_cb_time_changed (self, time, total_time);
}
-static gboolean
-xfmpc_interface_refresh (XfmpcInterface *interface)
-{
- if (G_UNLIKELY (xfmpc_mpdclient_connect (interface->mpdclient) == FALSE))
- {
- g_warning ("Failed to connect to MPD");
- xfmpc_mpdclient_disconnect (interface->mpdclient);
- xfmpc_interface_set_pp (interface, FALSE);
- xfmpc_interface_set_time (interface, 0, 0);
- xfmpc_interface_set_volume (interface, 0);
- xfmpc_interface_set_title (interface, _("Not connected"));
- xfmpc_interface_set_subtitle (interface, PACKAGE_STRING);
- /* Start a reconnection timeout and return FALSE to kill the refresh timeout */
- g_timeout_add (15000, (GSourceFunc)xfmpc_interface_reconnect, interface);
- return FALSE;
- }
+static void _xfmpc_interface_cb_volume_changed_xfmpc_mpdclient_volume_changed (XfmpcMpdclient* _sender, gint volume, gpointer self) {
+ xfmpc_interface_cb_volume_changed (self, volume);
+}
- xfmpc_mpdclient_update_status (interface->mpdclient);
- return TRUE;
+static void _xfmpc_interface_cb_stopped_xfmpc_mpdclient_stopped (XfmpcMpdclient* _sender, gpointer self) {
+ xfmpc_interface_cb_stopped (self);
}
-static gboolean
-xfmpc_interface_reconnect (XfmpcInterface *interface)
-{
- if (G_UNLIKELY (xfmpc_mpdclient_connect (interface->mpdclient) == FALSE))
- return TRUE;
- /* Refresh title/subtitle (bug #4975) */
- interface->priv->refresh_title = TRUE;
- if (xfmpc_mpdclient_is_playing (interface->mpdclient))
- cb_song_changed (interface);
- else
- cb_stopped (interface);
-
- /* Return FALSE to kill the reconnection timeout and start a refresh timeout */
- g_timeout_add (1000, (GSourceFunc)xfmpc_interface_refresh, interface);
- return FALSE;
+static GObject * xfmpc_interface_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ XfmpcInterfaceClass * klass;
+ GObjectClass * parent_class;
+ XfmpcInterface * self;
+ klass = XFMPC_INTERFACE_CLASS (g_type_class_peek (XFMPC_TYPE_INTERFACE));
+ parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = XFMPC_INTERFACE (obj);
+ {
+ GtkImage* image;
+ GtkButton* _tmp0_;
+ GtkImage* _tmp1_;
+ GtkButton* _tmp2_;
+ GtkImage* _tmp3_;
+ GtkButton* _tmp4_;
+ GtkVolumeButton* _tmp5_;
+ GtkAdjustment* _tmp6_;
+ GtkAdjustment* adjustment;
+ GtkEventBox* progress_box;
+ GtkProgressBar* _tmp7_;
+ PangoAttrList* attrs;
+ PangoAttribute* attr;
+ GtkLabel* _tmp8_;
+ PangoAttrList* _tmp9_;
+ GtkLabel* _tmp10_;
+ GtkHBox* box;
+ GtkVBox* vbox;
+ xfce_textdomain (self->priv->gettext_package, self->priv->localedir, "UTF-8");
+ self->priv->mpdclient = xfmpc_mpdclient_get ();
+ self->priv->preferences = xfmpc_preferences_get ();
+ gtk_container_set_border_width ((GtkContainer*) self, (guint) 4);
+ image = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_MEDIA_PREVIOUS, GTK_ICON_SIZE_BUTTON));
+ _tmp0_ = NULL;
+ self->priv->button_prev = (_tmp0_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), (self->priv->button_prev == NULL) ? NULL : (self->priv->button_prev = (g_object_unref (self->priv->button_prev), NULL)), _tmp0_);
+ gtk_button_set_relief (self->priv->button_prev, GTK_RELIEF_NONE);
+ gtk_container_add ((GtkContainer*) self->priv->button_prev, (GtkWidget*) image);
+ _tmp1_ = NULL;
+ image = (_tmp1_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON)), (image == NULL) ? NULL : (image = (g_object_unref (image), NULL)), _tmp1_);
+ _tmp2_ = NULL;
+ self->priv->button_pp = (_tmp2_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), (self->priv->button_pp == NULL) ? NULL : (self->priv->button_pp = (g_object_unref (self->priv->button_pp), NULL)), _tmp2_);
+ gtk_button_set_relief (self->priv->button_pp, GTK_RELIEF_NONE);
+ gtk_container_add ((GtkContainer*) self->priv->button_pp, (GtkWidget*) image);
+ _tmp3_ = NULL;
+ image = (_tmp3_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_MEDIA_NEXT, GTK_ICON_SIZE_BUTTON)), (image == NULL) ? NULL : (image = (g_object_unref (image), NULL)), _tmp3_);
+ _tmp4_ = NULL;
+ self->priv->button_next = (_tmp4_ = g_object_ref_sink ((GtkButton*) gtk_button_new ()), (self->priv->button_next == NULL) ? NULL : (self->priv->button_next = (g_object_unref (self->priv->button_next), NULL)), _tmp4_);
+ gtk_button_set_relief (self->priv->button_next, GTK_RELIEF_NONE);
+ gtk_container_add ((GtkContainer*) self->priv->button_next, (GtkWidget*) image);
+ _tmp5_ = NULL;
+ self->priv->button_volume = (_tmp5_ = g_object_ref_sink ((GtkVolumeButton*) gtk_volume_button_new ()), (self->priv->button_volume == NULL) ? NULL : (self->priv->button_volume = (g_object_unref (self->priv->button_volume), NULL)), _tmp5_);
+ gtk_button_set_relief ((GtkButton*) self->priv->button_volume, GTK_RELIEF_NONE);
+ _tmp6_ = NULL;
+ adjustment = (_tmp6_ = gtk_scale_button_get_adjustment ((GtkScaleButton*) self->priv->button_volume), (_tmp6_ == NULL) ? NULL : g_object_ref (_tmp6_));
+ gtk_adjustment_set_upper (adjustment, gtk_adjustment_get_upper (adjustment) * ((double) 100));
+ gtk_adjustment_set_step_increment (adjustment, gtk_adjustment_get_step_increment (adjustment) * ((double) 100));
+ gtk_adjustment_set_page_increment (adjustment, gtk_adjustment_get_page_increment (adjustment) * ((double) 100));
+ progress_box = g_object_ref_sink ((GtkEventBox*) gtk_event_box_new ());
+ _tmp7_ = NULL;
+ self->priv->progress_bar = (_tmp7_ = g_object_ref_sink ((GtkProgressBar*) gtk_progress_bar_new ()), (self->priv->progress_bar == NULL) ? NULL : (self->priv->progress_bar = (g_object_unref (self->priv->progress_bar), NULL)), _tmp7_);
+ gtk_progress_bar_set_text (self->priv->progress_bar, "0:00 / 0:00");
+ gtk_progress_bar_set_fraction (self->priv->progress_bar, 1.0);
+ gtk_container_add ((GtkContainer*) progress_box, (GtkWidget*) self->priv->progress_bar);
+ /* Title */
+ attrs = pango_attr_list_new ();
+ attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+ attr->start_index = (guint) 0;
+ attr->end_index = (guint) (-1);
+ pango_attr_list_insert (attrs, attr);
+ attr = pango_attr_scale_new ((double) PANGO_SCALE_X_LARGE);
+ attr->start_index = (guint) 0;
+ attr->end_index = (guint) (-1);
+ pango_attr_list_insert (attrs, attr);
+ _tmp8_ = NULL;
+ self->priv->title = (_tmp8_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Not connected"))), (self->priv->title == NULL) ? NULL : (self->priv->title = (g_object_unref (self->priv->title), NULL)), _tmp8_);
+ gtk_label_set_attributes (self->priv->title, attrs);
+ gtk_label_set_selectable (self->priv->title, TRUE);
+ gtk_label_set_ellipsize (self->priv->title, PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment ((GtkMisc*) self->priv->title, (float) 0, (float) 0.5);
+ /* Subtitle */
+ _tmp9_ = NULL;
+ attrs = (_tmp9_ = pango_attr_list_new (), (attrs == NULL) ? NULL : (attrs = (pango_attr_list_unref (attrs), NULL)), _tmp9_);
+ attr = pango_attr_scale_new ((double) PANGO_SCALE_SMALL);
+ attr->start_index = (guint) 0;
+ attr->end_index = (guint) (-1);
+ pango_attr_list_insert (attrs, attr);
+ _tmp10_ = NULL;
+ self->priv->subtitle = (_tmp10_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (PACKAGE_STRING)), (self->priv->subtitle == NULL) ? NULL : (self->priv->subtitle = (g_object_unref (self->priv->subtitle), NULL)), _tmp10_);
+ gtk_label_set_attributes (self->priv->subtitle, attrs);
+ gtk_label_set_selectable (self->priv->subtitle, TRUE);
+ gtk_label_set_ellipsize (self->priv->subtitle, PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment ((GtkMisc*) self->priv->subtitle, (float) 0, (float) 0.5);
+ /* === Containers === */
+ box = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0));
+ gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) box, FALSE, FALSE, (guint) 0);
+ gtk_box_pack_start ((GtkBox*) box, (GtkWidget*) self->priv->button_prev, FALSE, FALSE, (guint) 0);
+ gtk_box_pack_start ((GtkBox*) box, (GtkWidget*) self->priv->button_pp, FALSE, FALSE, (guint) 0);
+ gtk_box_pack_start ((GtkBox*) box, (GtkWidget*) self->priv->button_next, FALSE, FALSE, (guint) 0);
+ gtk_box_pack_start ((GtkBox*) box, (GtkWidget*) progress_box, TRUE, TRUE, (guint) 4);
+ gtk_box_pack_start ((GtkBox*) box, (GtkWidget*) self->priv->button_volume, FALSE, FALSE, (guint) 0);
+ vbox = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 0));
+ gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) vbox, FALSE, TRUE, (guint) 0);
+ gtk_container_add ((GtkContainer*) vbox, (GtkWidget*) self->priv->title);
+ gtk_container_add ((GtkContainer*) vbox, (GtkWidget*) self->priv->subtitle);
+ /* === Signals === */
+ g_signal_connect_object (self->priv->button_prev, "clicked", (GCallback) _xfmpc_interface_cb_mpdclient_previous_gtk_button_clicked, self, 0);
+ g_signal_connect_object (self->priv->button_pp, "clicked", (GCallback) _xfmpc_interface_pp_clicked_gtk_button_clicked, self, 0);
+ g_signal_connect_object (self->priv->button_next, "clicked", (GCallback) _xfmpc_interface_cb_mpdclient_next_gtk_button_clicked, self, 0);
+ g_signal_connect_object ((GtkScaleButton*) self->priv->button_volume, "value-changed", (GCallback) _xfmpc_interface_volume_changed_gtk_scale_button_value_changed, self, 0);
+ g_signal_connect_object ((GtkWidget*) progress_box, "button-release-event", (GCallback) _xfmpc_interface_cb_progress_box_release_event_gtk_widget_button_release_event, self, 0);
+ g_signal_connect_object (self->priv->mpdclient, "connected", (GCallback) _xfmpc_interface_reconnect_xfmpc_mpdclient_connected, self, 0);
+ g_signal_connect_object (self->priv->mpdclient, "song-changed", (GCallback) _xfmpc_interface_cb_song_changed_xfmpc_mpdclient_song_changed, self, 0);
+ g_signal_connect_object (self->priv->mpdclient, "pp-changed", (GCallback) _xfmpc_interface_cb_pp_changed_xfmpc_mpdclient_pp_changed, self, 0);
+ g_signal_connect_object (self->priv->mpdclient, "time-changed", (GCallback) _xfmpc_interface_cb_time_changed_xfmpc_mpdclient_time_changed, self, 0);
+ g_signal_connect_object (self->priv->mpdclient, "volume-changed", (GCallback) _xfmpc_interface_cb_volume_changed_xfmpc_mpdclient_volume_changed, self, 0);
+ g_signal_connect_object (self->priv->mpdclient, "stopped", (GCallback) _xfmpc_interface_cb_stopped_xfmpc_mpdclient_stopped, self, 0);
+ /* === Timeout === */
+ g_timeout_add ((guint) 1000, _xfmpc_interface_refresh_gsource_func, self);
+ (image == NULL) ? NULL : (image = (g_object_unref (image), NULL));
+ (adjustment == NULL) ? NULL : (adjustment = (g_object_unref (adjustment), NULL));
+ (progress_box == NULL) ? NULL : (progress_box = (g_object_unref (progress_box), NULL));
+ (attrs == NULL) ? NULL : (attrs = (pango_attr_list_unref (attrs), NULL));
+ (box == NULL) ? NULL : (box = (g_object_unref (box), NULL));
+ (vbox == NULL) ? NULL : (vbox = (g_object_unref (vbox), NULL));
+ }
+ return obj;
}
-static void
-cb_song_changed (XfmpcInterface *interface)
-{
- /* title */
- xfmpc_interface_set_title (interface, xfmpc_mpdclient_get_title (interface->mpdclient));
- /* subtitle "by \"artist\" from \"album\" (year)" */
- gchar *text = g_strdup_printf (_("by \"%s\" from \"%s\" (%s)"),
- xfmpc_mpdclient_get_artist (interface->mpdclient),
- xfmpc_mpdclient_get_album (interface->mpdclient),
- xfmpc_mpdclient_get_date (interface->mpdclient));
- /* text = xfmpc_interface_get_subtitle (interface); to avoid "n/a" values, so far I don't care */
- xfmpc_interface_set_subtitle (interface, text);
- g_free (text);
+static void xfmpc_interface_class_init (XfmpcInterfaceClass * klass) {
+ xfmpc_interface_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (XfmpcInterfacePrivate));
+ G_OBJECT_CLASS (klass)->constructor = xfmpc_interface_constructor;
+ G_OBJECT_CLASS (klass)->finalize = xfmpc_interface_finalize;
}
-static void
-cb_pp_changed (XfmpcInterface *interface,
- gboolean is_playing)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- xfmpc_interface_set_pp (interface, is_playing);
-
- if (priv->refresh_title)
- {
- cb_song_changed (interface);
- priv->refresh_title = FALSE;
- }
+static void xfmpc_interface_instance_init (XfmpcInterface * self) {
+ self->priv = XFMPC_INTERFACE_GET_PRIVATE (self);
+ self->priv->gettext_package = g_strdup (GETTEXT_PACKAGE);
+ self->priv->localedir = g_strdup (PACKAGE_LOCALE_DIR);
}
-static void
-cb_time_changed (XfmpcInterface *interface,
- gint time,
- gint total_time)
-{
- xfmpc_interface_set_time (interface, time, total_time);
+
+static void xfmpc_interface_finalize (GObject* obj) {
+ XfmpcInterface * self;
+ self = XFMPC_INTERFACE (obj);
+ self->priv->gettext_package = (g_free (self->priv->gettext_package), NULL);
+ self->priv->localedir = (g_free (self->priv->localedir), NULL);
+ (self->priv->button_prev == NULL) ? NULL : (self->priv->button_prev = (g_object_unref (self->priv->button_prev), NULL));
+ (self->priv->button_pp == NULL) ? NULL : (self->priv->button_pp = (g_object_unref (self->priv->button_pp), NULL));
+ (self->priv->button_next == NULL) ? NULL : (self->priv->button_next = (g_object_unref (self->priv->button_next), NULL));
+ (self->priv->button_volume == NULL) ? NULL : (self->priv->button_volume = (g_object_unref (self->priv->button_volume), NULL));
+ (self->priv->progress_bar == NULL) ? NULL : (self->priv->progress_bar = (g_object_unref (self->priv->progress_bar), NULL));
+ (self->priv->title == NULL) ? NULL : (self->priv->title = (g_object_unref (self->priv->title), NULL));
+ (self->priv->subtitle == NULL) ? NULL : (self->priv->subtitle = (g_object_unref (self->priv->subtitle), NULL));
+ G_OBJECT_CLASS (xfmpc_interface_parent_class)->finalize (obj);
}
-static void
-cb_volume_changed (XfmpcInterface *interface,
- gint volume)
-{
- xfmpc_interface_set_volume (interface, volume);
+
+GType xfmpc_interface_get_type (void) {
+ static GType xfmpc_interface_type_id = 0;
+ if (xfmpc_interface_type_id == 0) {
+ static const GTypeInfo g_define_type_info = { sizeof (XfmpcInterfaceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xfmpc_interface_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XfmpcInterface), 0, (GInstanceInitFunc) xfmpc_interface_instance_init, NULL };
+ xfmpc_interface_type_id = g_type_register_static (GTK_TYPE_VBOX, "XfmpcInterface", &g_define_type_info, 0);
+ }
+ return xfmpc_interface_type_id;
}
-static void
-cb_stopped (XfmpcInterface *interface)
-{
- XfmpcInterfacePrivate *priv = XFMPC_INTERFACE (interface)->priv;
- xfmpc_interface_set_pp (interface, FALSE);
- xfmpc_interface_set_time (interface, 0, 0);
- xfmpc_interface_set_title (interface, _("Stopped"));
- xfmpc_interface_set_subtitle (interface, PACKAGE_STRING);
- priv->refresh_title = TRUE;
-}
Added: xfmpc/trunk/src/interface.vala
===================================================================
--- xfmpc/trunk/src/interface.vala (rev 0)
+++ xfmpc/trunk/src/interface.vala 2009-05-02 23:06:23 UTC (rev 7309)
@@ -0,0 +1,295 @@
+/*
+ * 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.
+ */
+
+using Gtk;
+
+namespace Xfmpc {
+
+ public class Interface : VBox {
+
+ private unowned Xfmpc.Mpdclient mpdclient;
+ private unowned Xfmpc.Preferences preferences;
+
+ private string gettext_package = Config.GETTEXT_PACKAGE;
+ private string localedir = Config.PACKAGE_LOCALE_DIR;
+
+ 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 bool refresh_title;
+
+ construct {
+ Xfce.textdomain (gettext_package, localedir, "UTF-8");
+
+ mpdclient = Xfmpc.Mpdclient.get ();
+ 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);
+
+ 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 Image.from_stock (STOCK_MEDIA_NEXT, IconSize.BUTTON);
+ button_next = new Button ();
+ button_next.set_relief (ReliefStyle.NONE);
+ button_next.add (image);
+
+ button_volume = new VolumeButton ();
+ button_volume.set_relief (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 ();
+ progress_bar.set_text ("0:00 / 0:00");
+ progress_bar.set_fraction (1.0);
+ progress_box.add (progress_bar);
+
+ /* Title */
+ var attrs = new Pango.AttrList ();
+ unowned Pango.Attribute attr = Pango.attr_weight_new (Pango.Weight.BOLD);
+ attr.start_index = 0;
+ attr.end_index = -1;
+ attrs.insert (attr);
+
+ attr = Pango.attr_scale_new ((double) Pango.Scale.X_LARGE);
+ attr.start_index = 0;
+ attr.end_index = -1;
+ attrs.insert (attr);
+
+ title = new Label (_("Not connected"));
+ title.set_attributes (attrs);
+ title.set_selectable (true);
+ title.set_ellipsize (Pango.EllipsizeMode.END);
+ title.set_alignment (0, (float) 0.5);
+
+ /* Subtitle */
+ attrs = new Pango.AttrList ();
+ attr = Pango.attr_scale_new ((double) Pango.Scale.SMALL);
+ attr.start_index = 0;
+ 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);
+
+ /* === Containers === */
+ var box = new 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 (progress_box, true, true, 4);
+ box.pack_start (button_volume, false, false, 0);
+
+ var vbox = new VBox (false, 0);
+ pack_start (vbox, false, true, 0);
+ vbox.add (title);
+ vbox.add (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;
+ 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;
+
+ /* === Timeout === */
+ Timeout.add (1000, refresh);
+ }
+
+ public void set_title (string title) {
+ this.title.set_text (title);
+ }
+
+ public void set_subtitle (string subtitle) {
+ this.subtitle.set_text (subtitle);
+ }
+
+ public void pp_clicked () {
+ if (!mpdclient.pp ())
+ return;
+ set_pp (mpdclient.is_playing ());
+ }
+
+ public void set_pp (bool play) {
+ var image = (Image) button_pp.get_child ();
+
+ if (play == true)
+ image.set_from_stock (STOCK_MEDIA_PAUSE, IconSize.BUTTON);
+ else
+ image.set_from_stock (STOCK_MEDIA_PLAY, 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 ();
+ if (time_total < 0)
+ return false;
+
+ double time = event.x / progress_bar.allocation.width;
+ time *= time_total;
+
+ mpdclient.set_song_time ((int) time);
+
+ return true;
+ }
+
+ public void volume_changed (double value) {
+ mpdclient.set_volume ((char) value);
+ }
+
+ public void set_volume (int volume) {
+ button_volume.set_value (volume);
+ }
+
+ public void popup_volume () {
+ Signal.emit_by_name (button_volume, "popup", null);
+ }
+
+ public void set_time (int time, int time_total) {
+ int min, sec, min_total, sec_total;
+ double fraction = 1.0;
+
+ min = time / 60;
+ sec = time % 60;
+
+ min_total = time_total / 60;
+ sec_total = time_total % 60;
+
+ StringBuilder text = new StringBuilder ();
+ text.append_printf ("%d:%02d / %d:%02d", min, sec, min_total, sec_total);
+ 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);
+ }
+
+ private bool refresh () {
+ if (mpdclient.connect () == false) {
+ warning ("Failed to connect to MPD");
+ 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);
+ return false;
+ }
+
+ mpdclient.update_status ();
+ return true;
+ }
+
+ private void reconnect () {
+ if (mpdclient.connect () == false)
+ return;
+
+ /* Refresh title/subtitle (bug #4975) */
+ refresh_title = true;
+ if (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);
+ }
+
+ private void cb_song_changed () {
+ /* title */
+ set_title (mpdclient.get_title ());
+
+ /* subtitle "by \"artist\" from \"album\" (year)" */
+ StringBuilder text = new StringBuilder ();
+ text.append_printf (_("by \"%s\" from \"%s\" (%s)"),
+ mpdclient.get_artist (),
+ mpdclient.get_album (),
+ mpdclient.get_date ());
+
+ /* text = xfmpc_interface_get_subtitle (interface); to avoid "n/a" values, so far I don't care */
+ set_subtitle (text.str);
+ }
+
+ private void cb_pp_changed (bool is_playing) {
+ set_pp (is_playing);
+
+ if (refresh_title) {
+ cb_song_changed ();
+ refresh_title = false;
+ }
+ }
+
+ private void cb_time_changed (int time, int total_time) {
+ set_time (time, total_time);
+ }
+
+ private void cb_volume_changed (int volume) {
+ set_volume (volume);
+ }
+
+ private void cb_stopped () {
+ set_pp (false);
+ set_time (0, 0);
+ set_title (_("Stopped"));
+ set_subtitle (Config.PACKAGE_STRING);
+
+ refresh_title = true;
+ }
+
+ private void cb_mpdclient_previous () {
+ mpdclient.previous ();
+ }
+
+ private void cb_mpdclient_next () {
+ mpdclient.next ();
+ }
+ }
+}
+
+/* vi:set ts=8 sw=8: */
Modified: xfmpc/trunk/src/main-window.c
===================================================================
--- xfmpc/trunk/src/main-window.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/main-window.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2009 Vincent Legout <vincent at legout.info>
* 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
@@ -17,407 +17,547 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifdef HAVE_CONFIG_H
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <mpdclient.h>
+#include <preferences.h>
+#include <stdlib.h>
+#include <string.h>
#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <glib/gi18n-lib.h>
#include <libxfce4util/libxfce4util.h>
-#include "xfmpc.h"
-#include "main-window.h"
-#include "preferences.h"
-#include "interface.h"
-#include "main-ui.h"
-#define BORDER 4
+#define XFMPC_TYPE_MAIN_WINDOW (xfmpc_main_window_get_type ())
+#define XFMPC_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindow))
+#define XFMPC_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindowClass))
+#define XFMPC_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFMPC_TYPE_MAIN_WINDOW))
+#define XFMPC_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFMPC_TYPE_MAIN_WINDOW))
+#define XFMPC_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindowClass))
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindowPrivate))
+typedef struct _XfmpcMainWindow XfmpcMainWindow;
+typedef struct _XfmpcMainWindowClass XfmpcMainWindowClass;
+typedef struct _XfmpcMainWindowPrivate XfmpcMainWindowPrivate;
+#define XFMPC_TYPE_INTERFACE (xfmpc_interface_get_type ())
+#define XFMPC_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_INTERFACE, XfmpcInterface))
+#define XFMPC_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_INTERFACE, XfmpcInterfaceClass))
+#define XFMPC_IS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFMPC_TYPE_INTERFACE))
+#define XFMPC_IS_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFMPC_TYPE_INTERFACE))
+#define XFMPC_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFMPC_TYPE_INTERFACE, XfmpcInterfaceClass))
+typedef struct _XfmpcInterface XfmpcInterface;
+typedef struct _XfmpcInterfaceClass XfmpcInterfaceClass;
-static void xfmpc_main_window_class_init (XfmpcMainWindowClass *klass);
-static void xfmpc_main_window_init (XfmpcMainWindow *main_window);
-static void xfmpc_main_window_finalize (GObject *object);
+#define XFMPC_TYPE_STATUSBAR (xfmpc_statusbar_get_type ())
+#define XFMPC_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_STATUSBAR, XfmpcStatusbar))
+#define XFMPC_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_STATUSBAR, XfmpcStatusbarClass))
+#define XFMPC_IS_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFMPC_TYPE_STATUSBAR))
+#define XFMPC_IS_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFMPC_TYPE_STATUSBAR))
+#define XFMPC_STATUSBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFMPC_TYPE_STATUSBAR, XfmpcStatusbarClass))
-static gboolean cb_window_state_event (GtkWidget *window,
- GdkEventWindowState *event);
-static gboolean cb_window_closed (GtkWidget *window,
- GdkEvent *event);
-static void action_close (GtkAction *action,
- GtkWidget *window);
-static void action_previous (GtkAction *action,
- GtkWidget *window);
-static void action_pp (GtkAction *action,
- GtkWidget *window);
-static void action_stop (GtkAction *action,
- GtkWidget *window);
-static void action_next (GtkAction *action,
- GtkWidget *window);
-static void action_volume (GtkAction *action,
- GtkWidget *window);
+typedef struct _XfmpcStatusbar XfmpcStatusbar;
+typedef struct _XfmpcStatusbarClass XfmpcStatusbarClass;
-static void action_statusbar (GtkToggleAction *action,
- XfmpcMainWindow *main_window);
+#define XFMPC_TYPE_EXTENDED_INTERFACE (xfmpc_extended_interface_get_type ())
+#define XFMPC_EXTENDED_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_EXTENDED_INTERFACE, XfmpcExtendedInterface))
+#define XFMPC_EXTENDED_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_EXTENDED_INTERFACE, XfmpcExtendedInterfaceClass))
+#define XFMPC_IS_EXTENDED_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFMPC_TYPE_EXTENDED_INTERFACE))
+#define XFMPC_IS_EXTENDED_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFMPC_TYPE_EXTENDED_INTERFACE))
+#define XFMPC_EXTENDED_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFMPC_TYPE_EXTENDED_INTERFACE, XfmpcExtendedInterfaceClass))
-static void xfmpc_main_window_update_statusbar (XfmpcMainWindow *main_window);
+typedef struct _XfmpcExtendedInterface XfmpcExtendedInterface;
+typedef struct _XfmpcExtendedInterfaceClass XfmpcExtendedInterfaceClass;
-static void cb_playlist_changed (XfmpcMainWindow *main_window);
-static void cb_show_statusbar_changed (XfmpcMainWindow *main_window,
- GParamSpec *pspec);
+struct _XfmpcMainWindow {
+ GtkWindow parent_instance;
+ XfmpcMainWindowPrivate * priv;
+};
-
-
-static const GtkToggleActionEntry toggle_action_entries[] =
-{
- { "view-statusbar", NULL, "", NULL, NULL, G_CALLBACK (action_statusbar), FALSE, },
+struct _XfmpcMainWindowClass {
+ GtkWindowClass parent_class;
};
-
-
-static const GtkActionEntry action_entries[] =
-{
- { "quit", NULL, "", "<control>q", NULL, G_CALLBACK (action_close), },
-
- { "previous", NULL, "", "<control>b", NULL, G_CALLBACK (action_previous), },
- { "pp", NULL, "", "<control>p", NULL, G_CALLBACK (action_pp), },
- { "stop", NULL, "", "<control>s", NULL, G_CALLBACK (action_stop), },
- { "next", NULL, "", "<control>f", NULL, G_CALLBACK (action_next), },
- { "volume", NULL, "", "<control>v", NULL, G_CALLBACK (action_volume), },
+struct _XfmpcMainWindowPrivate {
+ XfmpcMpdclient* mpdclient;
+ XfmpcPreferences* preferences;
+ char* gettext_package;
+ char* localedir;
+ GtkVBox* vbox;
+ GtkActionGroup* action_group;
+ GtkWidget* statusbar;
+ GtkUIManager* ui_manager;
};
-struct _XfmpcMainWindowClass
-{
- GtkWindowClass parent;
+GType xfmpc_main_window_get_type (void);
+#define XFMPC_MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindowPrivate))
+enum {
+ XFMPC_MAIN_WINDOW_DUMMY_PROPERTY
};
+static void xfmpc_main_window_action_statusbar (XfmpcMainWindow* self, GtkAction* action);
+static void _xfmpc_main_window_action_statusbar_gtk_action_callback (GtkAction* action, gpointer self);
+static void xfmpc_main_window_action_close (XfmpcMainWindow* self);
+static void _xfmpc_main_window_action_close_gtk_action_callback (GtkAction* action, gpointer self);
+static void xfmpc_main_window_action_previous (XfmpcMainWindow* self);
+static void _xfmpc_main_window_action_previous_gtk_action_callback (GtkAction* action, gpointer self);
+static void xfmpc_main_window_action_pp (XfmpcMainWindow* self);
+static void _xfmpc_main_window_action_pp_gtk_action_callback (GtkAction* action, gpointer self);
+static void xfmpc_main_window_action_stop (XfmpcMainWindow* self);
+static void _xfmpc_main_window_action_stop_gtk_action_callback (GtkAction* action, gpointer self);
+static void xfmpc_main_window_action_next (XfmpcMainWindow* self);
+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
+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);
+GType xfmpc_interface_get_type (void);
+void xfmpc_interface_pp_clicked (XfmpcInterface* self);
+void xfmpc_interface_popup_volume (XfmpcInterface* self);
+XfmpcStatusbar* xfmpc_statusbar_new (void);
+XfmpcStatusbar* xfmpc_statusbar_construct (GType object_type);
+GType xfmpc_statusbar_get_type (void);
+void xfmpc_statusbar_set_text (XfmpcStatusbar* self, const char* value);
+static void xfmpc_main_window_update_statusbar (XfmpcMainWindow* self);
+static void xfmpc_main_window_cb_playlist_changed (XfmpcMainWindow* self);
+static void xfmpc_main_window_cb_show_statusbar_changed (XfmpcMainWindow* self, GParamSpec* pspec);
+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_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);
+XfmpcExtendedInterface* xfmpc_extended_interface_new (void);
+XfmpcExtendedInterface* xfmpc_extended_interface_construct (GType object_type);
+GType xfmpc_extended_interface_get_type (void);
+static void _xfmpc_main_window_cb_playlist_changed_xfmpc_mpdclient_playlist_changed (XfmpcMpdclient* _sender, gpointer self);
+static void _xfmpc_main_window_cb_show_statusbar_changed_xfmpc_preferences_notify (XfmpcPreferences* _sender, GParamSpec* pspec, gpointer self);
+static GObject * xfmpc_main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+static gpointer xfmpc_main_window_parent_class = NULL;
+static void xfmpc_main_window_finalize (GObject* obj);
-struct _XfmpcMainWindow
-{
- GtkWindow parent;
- XfmpcPreferences *preferences;
- XfmpcMpdclient *mpdclient;
- /*<private>*/
- XfmpcMainWindowPrivate *priv;
-};
+static const GtkToggleActionEntry XFMPC_MAIN_WINDOW_toggle_action_entries[] = {{"view-statusbar", NULL, "", NULL, NULL, (GCallback) _xfmpc_main_window_action_statusbar_gtk_action_callback, FALSE}};
+static const GtkActionEntry XFMPC_MAIN_WINDOW_action_entries[] = {{"quit", NULL, "", "<control>q", NULL, (GCallback) _xfmpc_main_window_action_close_gtk_action_callback}, {"previous", NULL, "", "<control>b", NULL, (GCallback) _xfmpc_main_window_action_previous_gtk_action_callback}, {"pp", NULL, "", "<control>p", NULL, (GCallback) _xfmpc_main_window_action_pp_gtk_action_callback}, {"stop", NULL, "", "<control>s", NULL, (GCallback) _xfmpc_main_window_action_stop_gtk_action_callback}, {"next", NULL, "", "<control>f", NULL, (GCallback) _xfmpc_main_window_action_next_gtk_action_callback}, {"volume", NULL, "", "<control>v", NULL, (GCallback) _xfmpc_main_window_action_volume_gtk_action_callback}};
-struct _XfmpcMainWindowPrivate
-{
- GtkActionGroup *action_group;
- GtkWidget *statusbar;
- GtkWidget *vbox;
-};
+static void _xfmpc_main_window_action_statusbar_gtk_action_callback (GtkAction* action, gpointer self) {
+ xfmpc_main_window_action_statusbar (self, action);
+}
-static GObjectClass *parent_class = NULL;
+static void _xfmpc_main_window_action_close_gtk_action_callback (GtkAction* action, gpointer self) {
+ xfmpc_main_window_action_close (self);
+}
+static void _xfmpc_main_window_action_previous_gtk_action_callback (GtkAction* action, gpointer self) {
+ xfmpc_main_window_action_previous (self);
+}
-GType
-xfmpc_main_window_get_type (void)
-{
- static GType xfmpc_main_window_type = G_TYPE_INVALID;
- if (G_UNLIKELY (xfmpc_main_window_type == G_TYPE_INVALID))
- {
- static const GTypeInfo xfmpc_main_window_info =
- {
- sizeof (XfmpcMainWindowClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) xfmpc_main_window_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (XfmpcMainWindow),
- 0,
- (GInstanceInitFunc) xfmpc_main_window_init,
- NULL
- };
+static void _xfmpc_main_window_action_pp_gtk_action_callback (GtkAction* action, gpointer self) {
+ xfmpc_main_window_action_pp (self);
+}
- xfmpc_main_window_type = g_type_register_static (GTK_TYPE_WINDOW, "XfmpcMainWindow", &xfmpc_main_window_info, 0);
- }
- return xfmpc_main_window_type;
+static void _xfmpc_main_window_action_stop_gtk_action_callback (GtkAction* action, gpointer self) {
+ xfmpc_main_window_action_stop (self);
}
-static void
-xfmpc_main_window_class_init (XfmpcMainWindowClass *klass)
-{
- GObjectClass *gobject_class;
- g_type_class_add_private (klass, sizeof (XfmpcMainWindowPrivate));
+static void _xfmpc_main_window_action_next_gtk_action_callback (GtkAction* action, gpointer self) {
+ xfmpc_main_window_action_next (self);
+}
- parent_class = g_type_class_peek_parent (klass);
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = xfmpc_main_window_finalize;
+static void _xfmpc_main_window_action_volume_gtk_action_callback (GtkAction* action, gpointer self) {
+ xfmpc_main_window_action_volume (self);
}
-static void
-xfmpc_main_window_init (XfmpcMainWindow *window)
-{
- XfmpcMainWindowPrivate *priv = window->priv = GET_PRIVATE (window);
- GtkAction *action;
- gboolean active;
- gint posx, posy;
- gint width, height;
- gboolean sticky;
+static gboolean xfmpc_main_window_cb_window_state_event (XfmpcMainWindow* self, const GdkEventWindowState* event) {
+ gboolean _tmp1_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ if ((*event).type != GDK_WINDOW_STATE) {
+ return FALSE;
+ }
+ _tmp1_ = FALSE;
+ if (((gboolean) (*event).changed_mask) & GDK_WINDOW_STATE_STICKY) {
+ gboolean _tmp2_;
+ _tmp1_ = (g_object_get ((GtkWidget*) self, "visible", &_tmp2_, NULL), _tmp2_);
+ } else {
+ _tmp1_ = FALSE;
+ }
+ /**
+ * Hiding the top level window will unstick it too, and send a
+ * window-state-event signal, so here we take the value only if
+ * the window is visible
+ **/
+ if (_tmp1_) {
+ gboolean sticky;
+ sticky = FALSE;
+ if ((((gboolean) (*event).new_window_state) & GDK_WINDOW_STATE_STICKY) == FALSE) {
+ sticky = FALSE;
+ } else {
+ sticky = TRUE;
+ }
+ xfmpc_preferences_set_last_window_state_sticky (self->priv->preferences, sticky);
+ }
+ return FALSE;
+}
- window->mpdclient = xfmpc_mpdclient_get ();
- window->preferences = xfmpc_preferences_get ();
- g_object_get (G_OBJECT (window->preferences),
- "last-window-posx", &posx,
- "last-window-posy", &posy,
- "last-window-width", &width,
- "last-window-height", &height,
- "last-window-state-sticky", &sticky,
- NULL);
+static gboolean xfmpc_main_window_cb_window_closed (XfmpcMainWindow* self, const GdkEvent* event) {
+ g_return_val_if_fail (self != NULL, FALSE);
+ xfmpc_main_window_close_window (self);
+ return FALSE;
+}
- /* Window */
- gtk_window_set_default_icon_name ("xfmpc");
- gtk_window_set_icon_name (GTK_WINDOW (window), "stock_volume");
- gtk_window_set_title (GTK_WINDOW (window), PACKAGE_NAME);
- gtk_window_set_default_size (GTK_WINDOW (window), 330, 330);
- g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (cb_window_closed), NULL);
- g_signal_connect (G_OBJECT (window), "window-state-event", G_CALLBACK (cb_window_state_event), NULL);
- priv->vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), priv->vbox);
+static void xfmpc_main_window_action_close (XfmpcMainWindow* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_main_window_close_window (self);
+}
- if (G_LIKELY (posx != -1 && posy != -1))
- gtk_window_move (GTK_WINDOW (window), posx, posy);
- if (G_LIKELY (width != -1 && height != -1))
- gtk_window_set_default_size (GTK_WINDOW (window), width, height);
- if (sticky == TRUE)
- gtk_window_stick (GTK_WINDOW (window));
- /* Interface */
- GtkWidget *interface = xfmpc_interface_new ();
- g_object_set_data (G_OBJECT (window), "XfmpcInterface", interface);
- gtk_box_pack_start (GTK_BOX (priv->vbox), interface, FALSE, FALSE, BORDER);
+static void xfmpc_main_window_close_window (XfmpcMainWindow* self) {
+ gint posx;
+ gint posy;
+ gint width;
+ gint height;
+ g_return_if_fail (self != NULL);
+ posx = 0;
+ posy = 0;
+ width = 0;
+ height = 0;
+ gtk_window_get_position ((GtkWindow*) self, &posx, &posy);
+ gtk_window_get_size ((GtkWindow*) self, &width, &height);
+ xfmpc_preferences_set_last_window_posx (self->priv->preferences, posx);
+ xfmpc_preferences_set_last_window_posy (self->priv->preferences, posy);
+ xfmpc_preferences_set_last_window_width (self->priv->preferences, width);
+ xfmpc_preferences_set_last_window_height (self->priv->preferences, height);
+ gtk_main_quit ();
+}
- /* Separator */
- GtkWidget *separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (priv->vbox), separator, FALSE, FALSE, 0);
- /* ExtendedInterface */
- GtkWidget *extended_interface = GTK_WIDGET (xfmpc_extended_interface_new ());
- gtk_box_pack_start (GTK_BOX (priv->vbox), extended_interface, TRUE, TRUE, 0);
+static void xfmpc_main_window_action_previous (XfmpcMainWindow* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_mpdclient_previous (self->priv->mpdclient);
+}
- /* Accelerators */
- GtkUIManager *ui_manager = gtk_ui_manager_new ();
- /* Action group */
- priv->action_group = gtk_action_group_new ("XfmpcMainWindow");
- gtk_action_group_add_actions (priv->action_group, action_entries,
- G_N_ELEMENTS (action_entries),
- GTK_WIDGET (window));
- gtk_action_group_add_toggle_actions (priv->action_group, toggle_action_entries,
- G_N_ELEMENTS (toggle_action_entries),
- GTK_WIDGET (window));
- gtk_ui_manager_insert_action_group (ui_manager, priv->action_group, 0);
- gtk_ui_manager_add_ui_from_string (ui_manager, main_ui, main_ui_length, NULL);
+static void xfmpc_main_window_action_pp (XfmpcMainWindow* self) {
+ XfmpcInterface* _tmp0_;
+ XfmpcInterface* interface;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = NULL;
+ interface = (_tmp0_ = XFMPC_INTERFACE (g_object_get_data ((GObject*) self, "XfmpcInterface")), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
+ xfmpc_interface_pp_clicked (interface);
+ (interface == NULL) ? NULL : (interface = (g_object_unref (interface), NULL));
+}
- /* Accel group */
- GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (ui_manager);
- gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
- /* show-statusbar action */
- action = gtk_action_group_get_action (priv->action_group, "view-statusbar");
- g_object_get (G_OBJECT (window->preferences), "show-statusbar", &active, NULL);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
+static void xfmpc_main_window_action_stop (XfmpcMainWindow* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_mpdclient_stop (self->priv->mpdclient);
+}
- /* === Signals === */
- g_signal_connect_swapped (window->mpdclient, "playlist-changed",
- G_CALLBACK (cb_playlist_changed), window);
- g_signal_connect_swapped (window->preferences, "notify::show-statusbar",
- G_CALLBACK (cb_show_statusbar_changed), window);
+static void xfmpc_main_window_action_next (XfmpcMainWindow* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_mpdclient_next (self->priv->mpdclient);
}
-static void
-xfmpc_main_window_finalize (GObject *object)
-{
- XfmpcMainWindow *window = XFMPC_MAIN_WINDOW (object);
- g_object_unref (G_OBJECT (window->mpdclient));
- g_object_unref (G_OBJECT (window->preferences));
- G_OBJECT_CLASS (parent_class)->finalize (object);
+
+static void xfmpc_main_window_action_volume (XfmpcMainWindow* self) {
+ XfmpcInterface* _tmp0_;
+ XfmpcInterface* interface;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = NULL;
+ interface = (_tmp0_ = XFMPC_INTERFACE (g_object_get_data ((GObject*) self, "XfmpcInterface")), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
+ xfmpc_interface_popup_volume (interface);
+ (interface == NULL) ? NULL : (interface = (g_object_unref (interface), NULL));
}
-
-GtkWidget*
-xfmpc_main_window_new ()
-{
- return g_object_new (XFMPC_TYPE_MAIN_WINDOW, NULL);
+static void xfmpc_main_window_action_statusbar (XfmpcMainWindow* self, GtkAction* action) {
+ gboolean active;
+ gboolean _tmp0_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (action != NULL);
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ _tmp0_ = FALSE;
+ if (!active) {
+ _tmp0_ = self->priv->statusbar != NULL;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ if (_tmp0_) {
+ GtkWidget* _tmp1_;
+ gtk_object_destroy ((GtkObject*) self->priv->statusbar);
+ _tmp1_ = NULL;
+ self->priv->statusbar = (_tmp1_ = NULL, (self->priv->statusbar == NULL) ? NULL : (self->priv->statusbar = (g_object_unref (self->priv->statusbar), NULL)), _tmp1_);
+ } else {
+ gboolean _tmp2_;
+ _tmp2_ = FALSE;
+ if (active) {
+ _tmp2_ = self->priv->statusbar == NULL;
+ } else {
+ _tmp2_ = FALSE;
+ }
+ if (_tmp2_) {
+ GtkWidget* _tmp3_;
+ _tmp3_ = NULL;
+ self->priv->statusbar = (_tmp3_ = (GtkWidget*) g_object_ref_sink (xfmpc_statusbar_new ()), (self->priv->statusbar == NULL) ? NULL : (self->priv->statusbar = (g_object_unref (self->priv->statusbar), NULL)), _tmp3_);
+ gtk_widget_show (self->priv->statusbar);
+ gtk_box_pack_start ((GtkBox*) self->priv->vbox, self->priv->statusbar, FALSE, FALSE, (guint) 0);
+ }
+ }
}
-static gboolean
-cb_window_state_event (GtkWidget *window,
- GdkEventWindowState *event)
-{
- if (G_UNLIKELY (event->type != GDK_WINDOW_STATE))
- return FALSE;
- /**
- * Hiding the top level window will unstick it too, and send a
- * window-state-event signal, so here we take the value only if
- * the window is visible
- **/
- if (event->changed_mask & GDK_WINDOW_STATE_STICKY && GTK_WIDGET_VISIBLE (window))
- {
- gboolean sticky = ((gboolean) event->new_window_state & GDK_WINDOW_STATE_STICKY) == FALSE ? FALSE : TRUE;
- XfmpcPreferences *preferences = xfmpc_preferences_get ();
- g_object_set (G_OBJECT (preferences),
- "last-window-state-sticky", sticky,
- NULL);
- g_object_unref (preferences);
- }
-
- return FALSE;
+static void xfmpc_main_window_update_statusbar (XfmpcMainWindow* self) {
+ gint seconds;
+ gint length;
+ GString* text;
+ g_return_if_fail (self != NULL);
+ seconds = 0;
+ length = 0;
+ if (self->priv->statusbar == NULL) {
+ return;
+ }
+ if (!xfmpc_mpdclient_is_connected (self->priv->mpdclient)) {
+ return;
+ }
+ length = xfmpc_mpdclient_playlist_get_length (self->priv->mpdclient);
+ seconds = xfmpc_mpdclient_playlist_get_total_time (self->priv->mpdclient);
+ text = g_string_new ("");
+ if ((seconds / 3600) > 0) {
+ g_string_append_printf (text, _ ("%d songs, %d hours and %d minutes"), length, seconds / 3600, (seconds / 60) % 60);
+ } else {
+ g_string_append_printf (text, _ ("%d songs, %d minutes"), length, (seconds / 60) % 60);
+ }
+ xfmpc_statusbar_set_text (XFMPC_STATUSBAR (self->priv->statusbar), text->str);
+ (text == NULL) ? NULL : (text = (g_string_free (text, TRUE), NULL));
}
-static gboolean
-cb_window_closed (GtkWidget *window,
- GdkEvent *event)
-{
- gint posx, posy;
- gint width, height;
- gtk_window_get_position (GTK_WINDOW (window), &posx, &posy);
- gtk_window_get_size (GTK_WINDOW (window), &width, &height);
- XfmpcPreferences *preferences = xfmpc_preferences_get ();
- g_object_set (G_OBJECT (preferences),
- "last-window-posx", posx,
- "last-window-posy", posy,
- "last-window-width", width,
- "last-window-height", height,
- NULL);
- g_object_unref (preferences);
-
- gtk_main_quit ();
- return FALSE;
+static void xfmpc_main_window_cb_playlist_changed (XfmpcMainWindow* self) {
+ g_return_if_fail (self != NULL);
+ xfmpc_main_window_update_statusbar (self);
}
-static void
-action_close (GtkAction *action,
- GtkWidget *window)
-{
- cb_window_closed (window, NULL);
+static void xfmpc_main_window_cb_show_statusbar_changed (XfmpcMainWindow* self, GParamSpec* pspec) {
+ GtkAction* _tmp0_;
+ GtkAction* action;
+ gboolean active;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (pspec != NULL);
+ _tmp0_ = NULL;
+ action = (_tmp0_ = gtk_action_group_get_action (self->priv->action_group, "view-statusbar"), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
+ active = xfmpc_preferences_get_show_statusbar (self->priv->preferences);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
+ xfmpc_main_window_update_statusbar (self);
+ (action == NULL) ? NULL : (action = (g_object_unref (action), NULL));
}
-static void
-action_previous (GtkAction *action,
- GtkWidget *window)
-{
- XfmpcInterface *interface = g_object_get_data (G_OBJECT (window), "XfmpcInterface");
- xfmpc_mpdclient_previous (interface->mpdclient);
+
+XfmpcMainWindow* xfmpc_main_window_construct (GType object_type) {
+ XfmpcMainWindow * self;
+ self = g_object_newv (object_type, 0, NULL);
+ return self;
}
-static void
-action_pp (GtkAction *action,
- GtkWidget *window)
-{
- XfmpcInterface *interface = g_object_get_data (G_OBJECT (window), "XfmpcInterface");
- xfmpc_interface_pp_clicked (interface);
+
+XfmpcMainWindow* xfmpc_main_window_new (void) {
+ return xfmpc_main_window_construct (XFMPC_TYPE_MAIN_WINDOW);
}
-static void
-action_stop (GtkAction *action,
- GtkWidget *window)
-{
- XfmpcInterface *interface = g_object_get_data (G_OBJECT (window), "XfmpcInterface");
- xfmpc_mpdclient_stop (interface->mpdclient);
+
+static gboolean _xfmpc_main_window_cb_window_closed_gtk_widget_delete_event (XfmpcMainWindow* _sender, const GdkEvent* event, gpointer self) {
+ return xfmpc_main_window_cb_window_closed (self, event);
}
-static void
-action_next (GtkAction *action,
- GtkWidget *window)
-{
- XfmpcInterface *interface = g_object_get_data (G_OBJECT (window), "XfmpcInterface");
- xfmpc_mpdclient_next (interface->mpdclient);
+
+static gboolean _xfmpc_main_window_cb_window_state_event_gtk_widget_window_state_event (XfmpcMainWindow* _sender, const GdkEventWindowState* event, gpointer self) {
+ return xfmpc_main_window_cb_window_state_event (self, event);
}
-static void
-action_volume (GtkAction *action,
- GtkWidget *window)
-{
- XfmpcInterface *interface = g_object_get_data (G_OBJECT (window), "XfmpcInterface");
- xfmpc_interface_popup_volume (interface);
+
+static void _xfmpc_main_window_cb_playlist_changed_xfmpc_mpdclient_playlist_changed (XfmpcMpdclient* _sender, gpointer self) {
+ xfmpc_main_window_cb_playlist_changed (self);
}
-static void
-action_statusbar (GtkToggleAction *action,
- XfmpcMainWindow *window)
-{
- XfmpcMainWindowPrivate *priv = XFMPC_MAIN_WINDOW (window)->priv;
- gboolean active;
+static void _xfmpc_main_window_cb_show_statusbar_changed_xfmpc_preferences_notify (XfmpcPreferences* _sender, GParamSpec* pspec, gpointer self) {
+ xfmpc_main_window_cb_show_statusbar_changed (self, pspec);
+}
- active = gtk_toggle_action_get_active (action);
- if (!active && priv->statusbar != NULL)
- {
- gtk_widget_destroy (priv->statusbar);
- priv->statusbar = NULL;
- }
- else if (active && priv->statusbar == NULL)
- {
- priv->statusbar = GTK_WIDGET (xfmpc_statusbar_new ());
- gtk_widget_show (priv->statusbar);
- gtk_box_pack_start (GTK_BOX (priv->vbox), priv->statusbar, FALSE, FALSE, 0);
- }
+static GObject * xfmpc_main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ XfmpcMainWindowClass * klass;
+ GObjectClass * parent_class;
+ XfmpcMainWindow * self;
+ GError * _inner_error_;
+ klass = XFMPC_MAIN_WINDOW_CLASS (g_type_class_peek (XFMPC_TYPE_MAIN_WINDOW));
+ parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = XFMPC_MAIN_WINDOW (obj);
+ _inner_error_ = NULL;
+ {
+ GtkVBox* _tmp0_;
+ gboolean _tmp1_;
+ gboolean _tmp2_;
+ XfmpcInterface* interface;
+ GtkHSeparator* separator;
+ XfmpcExtendedInterface* extended_interface;
+ GtkUIManager* _tmp3_;
+ GtkActionGroup* _tmp4_;
+ GtkAccelGroup* _tmp5_;
+ GtkAccelGroup* accel_group;
+ xfce_textdomain (self->priv->gettext_package, self->priv->localedir, "UTF-8");
+ self->priv->mpdclient = xfmpc_mpdclient_get ();
+ self->priv->preferences = xfmpc_preferences_get ();
+ /* Window */
+ gtk_window_set_default_icon_name ("xfmpc");
+ gtk_window_set_icon_name ((GtkWindow*) self, "stock_volume");
+ gtk_window_set_title ((GtkWindow*) self, PACKAGE_NAME);
+ gtk_window_set_default_size ((GtkWindow*) self, 330, 330);
+ g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) _xfmpc_main_window_cb_window_closed_gtk_widget_delete_event, self, 0);
+ g_signal_connect_object ((GtkWidget*) self, "window-state-event", (GCallback) _xfmpc_main_window_cb_window_state_event_gtk_widget_window_state_event, self, 0);
+ _tmp0_ = NULL;
+ self->priv->vbox = (_tmp0_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 0)), (self->priv->vbox == NULL) ? NULL : (self->priv->vbox = (g_object_unref (self->priv->vbox), NULL)), _tmp0_);
+ gtk_container_add ((GtkContainer*) self, (GtkWidget*) self->priv->vbox);
+ _tmp1_ = FALSE;
+ if (xfmpc_preferences_get_last_window_posx (self->priv->preferences) != (-1)) {
+ _tmp1_ = xfmpc_preferences_get_last_window_posy (self->priv->preferences) != (-1);
+ } else {
+ _tmp1_ = FALSE;
+ }
+ if (_tmp1_) {
+ gtk_window_move ((GtkWindow*) self, xfmpc_preferences_get_last_window_posx (self->priv->preferences), xfmpc_preferences_get_last_window_posy (self->priv->preferences));
+ }
+ _tmp2_ = FALSE;
+ if (xfmpc_preferences_get_last_window_width (self->priv->preferences) != (-1)) {
+ _tmp2_ = xfmpc_preferences_get_last_window_height (self->priv->preferences) != (-1);
+ } else {
+ _tmp2_ = FALSE;
+ }
+ if (_tmp2_) {
+ gtk_window_set_default_size ((GtkWindow*) self, xfmpc_preferences_get_last_window_width (self->priv->preferences), xfmpc_preferences_get_last_window_height (self->priv->preferences));
+ }
+ if (xfmpc_preferences_get_last_window_state_sticky (self->priv->preferences) == TRUE) {
+ gtk_window_stick ((GtkWindow*) self);
+ }
+ /* Interface */
+ interface = g_object_ref_sink (xfmpc_interface_new ());
+ g_object_set_data ((GObject*) self, "XfmpcInterface", interface);
+ gtk_box_pack_start ((GtkBox*) self->priv->vbox, (GtkWidget*) interface, FALSE, FALSE, (guint) 4);
+ /* Separator */
+ separator = g_object_ref_sink ((GtkHSeparator*) gtk_hseparator_new ());
+ gtk_box_pack_start ((GtkBox*) self->priv->vbox, (GtkWidget*) separator, FALSE, FALSE, (guint) 0);
+ /* ExtendedInterface */
+ extended_interface = g_object_ref_sink (xfmpc_extended_interface_new ());
+ gtk_box_pack_start ((GtkBox*) self->priv->vbox, (GtkWidget*) extended_interface, TRUE, TRUE, (guint) 0);
+ /* Accelerators */
+ _tmp3_ = NULL;
+ self->priv->ui_manager = (_tmp3_ = gtk_ui_manager_new (), (self->priv->ui_manager == NULL) ? NULL : (self->priv->ui_manager = (g_object_unref (self->priv->ui_manager), NULL)), _tmp3_);
+ /* Action group */
+ _tmp4_ = NULL;
+ self->priv->action_group = (_tmp4_ = gtk_action_group_new ("XfmpcMainWindow"), (self->priv->action_group == NULL) ? NULL : (self->priv->action_group = (g_object_unref (self->priv->action_group), NULL)), _tmp4_);
+ gtk_action_group_add_actions (self->priv->action_group, XFMPC_MAIN_WINDOW_action_entries, G_N_ELEMENTS (XFMPC_MAIN_WINDOW_action_entries), self);
+ 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_);
+ if (_inner_error_ != NULL) {
+ goto __catch0_g_error;
+ goto __finally0;
+ }
+ }
+ goto __finally0;
+ __catch0_g_error:
+ {
+ GError * e;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ {
+ g_warning (e->message);
+ (e == NULL) ? NULL : (e = (g_error_free (e), NULL));
+ }
+ }
+ __finally0:
+ if (_inner_error_ != NULL) {
+ (interface == NULL) ? NULL : (interface = (g_object_unref (interface), NULL));
+ (separator == NULL) ? NULL : (separator = (g_object_unref (separator), NULL));
+ (extended_interface == NULL) ? NULL : (extended_interface = (g_object_unref (extended_interface), NULL));
+ g_critical ("file %s: line %d: uncaught error: %s", __FILE__, __LINE__, _inner_error_->message);
+ g_clear_error (&_inner_error_);
+ }
+ /* Accel group */
+ _tmp5_ = NULL;
+ accel_group = (_tmp5_ = gtk_ui_manager_get_accel_group (self->priv->ui_manager), (_tmp5_ == NULL) ? NULL : g_object_ref (_tmp5_));
+ gtk_window_add_accel_group ((GtkWindow*) self, accel_group);
+ /* show-statusbar action */
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (gtk_action_group_get_action (self->priv->action_group, "view-statusbar")), xfmpc_preferences_get_show_statusbar (self->priv->preferences));
+ /* === Signals === */
+ g_signal_connect_object (self->priv->mpdclient, "playlist-changed", (GCallback) _xfmpc_main_window_cb_playlist_changed_xfmpc_mpdclient_playlist_changed, self, 0);
+ g_signal_connect_object (self->priv->preferences, "notify::show-statusbar", (GCallback) _xfmpc_main_window_cb_show_statusbar_changed_xfmpc_preferences_notify, self, 0);
+ (interface == NULL) ? NULL : (interface = (g_object_unref (interface), NULL));
+ (separator == NULL) ? NULL : (separator = (g_object_unref (separator), NULL));
+ (extended_interface == NULL) ? NULL : (extended_interface = (g_object_unref (extended_interface), NULL));
+ (accel_group == NULL) ? NULL : (accel_group = (g_object_unref (accel_group), NULL));
+ }
+ return obj;
}
-static void
-xfmpc_main_window_update_statusbar (XfmpcMainWindow *window)
-{
- XfmpcMainWindowPrivate *priv = XFMPC_MAIN_WINDOW (window)->priv;
- gchar *text;
- gint seconds, length;
- if (G_UNLIKELY (priv->statusbar == NULL))
- return;
+static void xfmpc_main_window_class_init (XfmpcMainWindowClass * klass) {
+ xfmpc_main_window_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (XfmpcMainWindowPrivate));
+ G_OBJECT_CLASS (klass)->constructor = xfmpc_main_window_constructor;
+ G_OBJECT_CLASS (klass)->finalize = xfmpc_main_window_finalize;
+}
- if (!xfmpc_mpdclient_is_connected (window->mpdclient))
- return;
- length = xfmpc_mpdclient_playlist_get_length (window->mpdclient);
- seconds = xfmpc_mpdclient_playlist_get_total_time (window->mpdclient);
+static void xfmpc_main_window_instance_init (XfmpcMainWindow * self) {
+ self->priv = XFMPC_MAIN_WINDOW_GET_PRIVATE (self);
+ self->priv->gettext_package = g_strdup (GETTEXT_PACKAGE);
+ self->priv->localedir = g_strdup (PACKAGE_LOCALE_DIR);
+}
- if (seconds / 3600 > 0)
- text = g_strdup_printf (_("%d songs, %d hours and %d minutes"), length, seconds / 3600, (seconds / 60) % 60);
- else
- text = g_strdup_printf (_("%d songs, %d minutes"), length, (seconds / 60) % 60);
- g_object_set (G_OBJECT (priv->statusbar), "text", text, NULL);
- g_free (text);
+static void xfmpc_main_window_finalize (GObject* obj) {
+ XfmpcMainWindow * self;
+ self = XFMPC_MAIN_WINDOW (obj);
+ self->priv->gettext_package = (g_free (self->priv->gettext_package), NULL);
+ self->priv->localedir = (g_free (self->priv->localedir), NULL);
+ (self->priv->vbox == NULL) ? NULL : (self->priv->vbox = (g_object_unref (self->priv->vbox), NULL));
+ (self->priv->action_group == NULL) ? NULL : (self->priv->action_group = (g_object_unref (self->priv->action_group), NULL));
+ (self->priv->statusbar == NULL) ? NULL : (self->priv->statusbar = (g_object_unref (self->priv->statusbar), NULL));
+ (self->priv->ui_manager == NULL) ? NULL : (self->priv->ui_manager = (g_object_unref (self->priv->ui_manager), NULL));
+ G_OBJECT_CLASS (xfmpc_main_window_parent_class)->finalize (obj);
}
-static void
-cb_playlist_changed (XfmpcMainWindow *window)
-{
- xfmpc_main_window_update_statusbar (window);
+
+GType xfmpc_main_window_get_type (void) {
+ static GType xfmpc_main_window_type_id = 0;
+ if (xfmpc_main_window_type_id == 0) {
+ static const GTypeInfo g_define_type_info = { sizeof (XfmpcMainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xfmpc_main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XfmpcMainWindow), 0, (GInstanceInitFunc) xfmpc_main_window_instance_init, NULL };
+ xfmpc_main_window_type_id = g_type_register_static (GTK_TYPE_WINDOW, "XfmpcMainWindow", &g_define_type_info, 0);
+ }
+ return xfmpc_main_window_type_id;
}
-static void
-cb_show_statusbar_changed (XfmpcMainWindow *window,
- GParamSpec *pspec)
-{
- XfmpcMainWindowPrivate *priv = window->priv;
- gboolean active;
- GtkAction *action;
- action = gtk_action_group_get_action (priv->action_group, "view-statusbar");
- g_object_get (window->preferences, "show-statusbar", &active, NULL);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
- xfmpc_main_window_update_statusbar (window);
-}
Added: xfmpc/trunk/src/main-window.vala
===================================================================
--- xfmpc/trunk/src/main-window.vala (rev 0)
+++ xfmpc/trunk/src/main-window.vala 2009-05-02 23:06:23 UTC (rev 7309)
@@ -0,0 +1,234 @@
+/*
+ * 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.
+ */
+
+using Gtk;
+
+namespace Xfmpc {
+
+ public class MainWindow : Window {
+
+ private unowned Xfmpc.Mpdclient mpdclient;
+ private unowned Xfmpc.Preferences preferences;
+
+ private string gettext_package = Config.GETTEXT_PACKAGE;
+ private string localedir = Config.PACKAGE_LOCALE_DIR;
+
+ private VBox vbox;
+ private ActionGroup action_group;
+ private Widget statusbar;
+ private UIManager ui_manager;
+
+ private const ToggleActionEntry[] toggle_action_entries = {
+ { "view-statusbar", null, "", null, null, action_statusbar, false }
+ };
+
+ private const ActionEntry[] action_entries = {
+ { "quit", null, "", "<control>q", null, action_close },
+ { "previous", null, "", "<control>b", null, action_previous },
+ { "pp", null, "", "<control>p", null, action_pp },
+ { "stop", null, "", "<control>s", null, action_stop },
+ { "next", null, "", "<control>f", null, action_next },
+ { "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;
+
+ construct {
+ Xfce.textdomain (gettext_package, localedir, "UTF-8");
+
+ mpdclient = Xfmpc.Mpdclient.get ();
+ preferences = Xfmpc.Preferences.get ();
+
+ /* Window */
+ set_default_icon_name ("xfmpc");
+ set_icon_name ("stock_volume");
+ set_title (Config.PACKAGE_NAME);
+ set_default_size (330, 330);
+ this.delete_event += cb_window_closed;
+ this.window_state_event += cb_window_state_event;
+
+ vbox = new 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)
+ stick ();
+
+ /* Interface */
+ var interface = new Interface ();
+ set_data ("XfmpcInterface", interface);
+ vbox.pack_start (interface, false, false, 4);
+
+ /* Separator */
+ var separator = new HSeparator ();
+ vbox.pack_start (separator, false, false, 0);
+
+ /* ExtendedInterface */
+ var extended_interface = new ExtendedInterface ();
+ vbox.pack_start (extended_interface, true, true, 0);
+
+ /* Accelerators */
+ ui_manager = new 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);
+ try {
+ ui_manager.add_ui_from_string (main_ui, main_ui_length);
+ } catch (Error e) {
+ warning (e.message);
+ }
+
+ /* Accel group */
+ var accel_group = 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);
+
+ /* === Signals === */
+ mpdclient.playlist_changed += cb_playlist_changed;
+ preferences.notify["show-statusbar"] += cb_show_statusbar_changed;
+ }
+
+ private bool cb_window_state_event (Gdk.EventWindowState event) {
+ if (event.type != Gdk.EventType.WINDOW_STATE)
+ return false;
+
+ /**
+ * Hiding the top level window will unstick it too, and send a
+ * window-state-event signal, so here we take the value only if
+ * the window is visible
+ **/
+ if ((bool) event.changed_mask & Gdk.WindowState.STICKY && this.visible){
+ bool sticky;
+ if (((bool) event.new_window_state & Gdk.WindowState.STICKY) == false)
+ sticky = false;
+ else
+ sticky = true;
+
+ preferences.last_window_state_sticky = sticky;
+ }
+
+ return false;
+ }
+
+ private bool cb_window_closed (Gdk.Event event) {
+ close_window ();
+
+ return false;
+ }
+
+ private void action_close () {
+ close_window ();
+ }
+
+ private void close_window () {
+ int posx, posy;
+ int width, height;
+
+ 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;
+
+ main_quit ();
+ }
+
+ private void action_previous () {
+ mpdclient.previous ();
+ }
+
+ private void action_pp () {
+ Interface interface = (Interface) get_data ("XfmpcInterface");
+ interface.pp_clicked ();
+ }
+
+ private void action_stop () {
+ mpdclient.stop ();
+ }
+
+ private void action_next () {
+ mpdclient.next ();
+ }
+
+ private void action_volume () {
+ Interface interface = (Interface) get_data ("XfmpcInterface");
+ interface.popup_volume ();
+ }
+
+ private void action_statusbar (Action action) {
+ bool active = ((ToggleAction) action).get_active ();
+
+ if (!active && statusbar != null) {
+ statusbar.destroy ();
+ statusbar = null;
+ }
+ else if (active && statusbar == null) {
+ statusbar = new Statusbar ();
+ statusbar.show ();
+ vbox.pack_start (statusbar, false, false, 0);
+ }
+ }
+
+ private void update_statusbar () {
+ int seconds, length;
+
+ if (statusbar == null)
+ return;
+
+ if (!mpdclient.is_connected ())
+ return;
+
+ length = mpdclient.playlist_get_length ();
+ seconds = mpdclient.playlist_get_total_time ();
+
+ StringBuilder text = new 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;
+ }
+
+ private void cb_playlist_changed () {
+ update_statusbar ();
+ }
+
+ private void cb_show_statusbar_changed (ParamSpec pspec) {
+ var action = action_group.get_action ("view-statusbar");
+ bool active = preferences.show_statusbar;
+
+ ((ToggleAction) action).set_active (active);
+ update_statusbar ();
+ }
+ }
+}
+
+/* vi:set ts=8 sw=8: */
Modified: xfmpc/trunk/src/main.c
===================================================================
--- xfmpc/trunk/src/main.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/main.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -31,7 +31,7 @@
#include <gtk/gtk.h>
#include <libxfcegui4/libxfcegui4.h>
-#include "main-window.h"
+#include "xfmpc.h"
Modified: xfmpc/trunk/src/playlist.c
===================================================================
--- xfmpc/trunk/src/playlist.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/playlist.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -190,34 +190,34 @@
static gboolean xfmpc_playlist_visible_func_filter_tree (GtkTreeModel* model, GtkTreeIter* iter) {
char* song;
char* search;
- gboolean result;
- char* _tmp2;
- const char* _tmp1;
- char* _tmp3;
- gboolean _tmp5;
+ gboolean _result_;
+ char* _tmp2_;
+ const char* _tmp1_;
+ char* _tmp3_;
+ gboolean _tmp5_;
g_return_val_if_fail (model != NULL, FALSE);
song = g_strdup ("");
search = g_strdup ("");
- result = TRUE;
+ _result_ = TRUE;
gtk_tree_model_get (model, &(*iter), XFMPC_PLAYLIST_COLUMNS_COLUMN_SONG, &song, -1, -1);
if (_vala_strcmp0 (song, "") == 0) {
- gboolean _tmp0;
- return (_tmp0 = TRUE, song = (g_free (song), NULL), search = (g_free (search), NULL), _tmp0);
+ gboolean _tmp0_;
+ return (_tmp0_ = TRUE, song = (g_free (song), NULL), search = (g_free (search), NULL), _tmp0_);
}
- _tmp2 = NULL;
- _tmp1 = NULL;
- search = (_tmp2 = (_tmp1 = gtk_entry_get_text (xfmpc_playlist_filter_entry), (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), search = (g_free (search), NULL), _tmp2);
- _tmp3 = NULL;
- search = (_tmp3 = g_utf8_casefold (search, (glong) (-1)), search = (g_free (search), NULL), _tmp3);
+ _tmp2_ = NULL;
+ _tmp1_ = NULL;
+ search = (_tmp2_ = (_tmp1_ = gtk_entry_get_text (xfmpc_playlist_filter_entry), (_tmp1_ == NULL) ? NULL : g_strdup (_tmp1_)), search = (g_free (search), NULL), _tmp2_);
+ _tmp3_ = NULL;
+ search = (_tmp3_ = g_utf8_casefold (search, (glong) (-1)), search = (g_free (search), NULL), _tmp3_);
if (_vala_strcmp0 (search, "") != 0) {
- char* _tmp4;
- _tmp4 = NULL;
- song = (_tmp4 = g_utf8_casefold (song, (glong) (-1)), song = (g_free (song), NULL), _tmp4);
+ char* _tmp4_;
+ _tmp4_ = NULL;
+ song = (_tmp4_ = g_utf8_casefold (song, (glong) (-1)), song = (g_free (song), NULL), _tmp4_);
if (strstr (song, search) == NULL) {
- result = FALSE;
+ _result_ = FALSE;
}
}
- return (_tmp5 = result, song = (g_free (song), NULL), search = (g_free (search), NULL), _tmp5);
+ return (_tmp5_ = _result_, song = (g_free (song), NULL), search = (g_free (search), NULL), _tmp5_);
}
@@ -233,53 +233,53 @@
static void xfmpc_playlist_cb_browse_selection (XfmpcPlaylist* self) {
XfmpcDbbrowser* dbbrowser;
XfmpcExtendedInterface* extended_interface;
- GtkTreeSelection* _tmp0;
+ GtkTreeSelection* _tmp0_;
GtkTreeSelection* selection;
- GtkListStore* _tmp1;
+ GtkListStore* _tmp1_;
GtkListStore* model;
- GtkListStore* _tmp5;
- GtkListStore* _tmp4;
- GList* _tmp3;
- GtkTreeModel* _tmp2;
+ GtkListStore* _tmp5_;
+ GtkListStore* _tmp4_;
+ GList* _tmp3_;
+ GtkTreeModel* _tmp2_;
GList* list;
GtkTreeIter iter = {0};
- const GtkTreePath* _tmp6;
+ const GtkTreePath* _tmp6_;
GtkTreePath* path;
g_return_if_fail (self != NULL);
dbbrowser = NULL;
extended_interface = NULL;
dbbrowser = XFMPC_DBBROWSER (g_object_get_data ((GObject*) self, "XfmpcDbbrowser"));
extended_interface = XFMPC_EXTENDED_INTERFACE (g_object_get_data ((GObject*) self, "XfmpcExtendedInterface"));
- _tmp0 = NULL;
- selection = (_tmp0 = gtk_tree_view_get_selection (self->priv->treeview), (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
+ _tmp0_ = NULL;
+ selection = (_tmp0_ = gtk_tree_view_get_selection (self->priv->treeview), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
if (gtk_tree_selection_count_selected_rows (selection) > 1) {
(selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL));
return;
}
- _tmp1 = NULL;
- model = (_tmp1 = self->priv->store, (_tmp1 == NULL) ? NULL : g_object_ref (_tmp1));
- _tmp5 = NULL;
- _tmp4 = NULL;
- _tmp3 = NULL;
- _tmp2 = NULL;
- list = (_tmp3 = gtk_tree_selection_get_selected_rows (selection, &_tmp2), model = (_tmp4 = (_tmp5 = (GtkListStore*) _tmp2, (_tmp5 == NULL) ? NULL : g_object_ref (_tmp5)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp4), _tmp3);
+ _tmp1_ = NULL;
+ model = (_tmp1_ = self->priv->store, (_tmp1_ == NULL) ? NULL : g_object_ref (_tmp1_));
+ _tmp5_ = NULL;
+ _tmp4_ = NULL;
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ list = (_tmp3_ = gtk_tree_selection_get_selected_rows (selection, &_tmp2_), model = (_tmp4_ = (_tmp5_ = (GtkListStore*) _tmp2_, (_tmp5_ == NULL) ? NULL : g_object_ref (_tmp5_)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp4_), _tmp3_);
if (g_list_length (list) == 0) {
(selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL));
(model == NULL) ? NULL : (model = (g_object_unref (model), NULL));
(list == NULL) ? NULL : (list = (_g_list_free_gtk_tree_path_free (list), NULL));
return;
}
- _tmp6 = NULL;
- path = (_tmp6 = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp6 == NULL) ? NULL : gtk_tree_path_copy (_tmp6));
+ _tmp6_ = NULL;
+ path = (_tmp6_ = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp6_ == NULL) ? NULL : gtk_tree_path_copy (_tmp6_));
if (gtk_tree_model_get_iter ((GtkTreeModel*) self->priv->store, &iter, path)) {
char* filename;
char* dir;
- char* _tmp7;
+ char* _tmp7_;
filename = g_strdup ("");
dir = NULL;
gtk_tree_model_get ((GtkTreeModel*) self->priv->store, &iter, XFMPC_PLAYLIST_COLUMNS_COLUMN_FILENAME, &filename, -1, -1);
- _tmp7 = NULL;
- dir = (_tmp7 = g_path_get_dirname (filename), dir = (g_free (dir), NULL), _tmp7);
+ _tmp7_ = NULL;
+ dir = (_tmp7_ = g_path_get_dirname (filename), dir = (g_free (dir), NULL), _tmp7_);
xfmpc_dbbrowser_set_wdir (dbbrowser, dir);
xfmpc_dbbrowser_reload (dbbrowser);
xfmpc_extended_interface_set_active (extended_interface, XFMPC_EXTENDED_INTERFACE_EXTENDED_INTERFACE_WIDGET_DBBROWSER);
@@ -296,40 +296,40 @@
static void xfmpc_playlist_cb_info_selection (XfmpcPlaylist* self) {
GtkTreeIter iter = {0};
gint id;
- GtkTreeSelection* _tmp0;
+ GtkTreeSelection* _tmp0_;
GtkTreeSelection* selection;
- GtkListStore* _tmp1;
+ GtkListStore* _tmp1_;
GtkListStore* model;
- GtkListStore* _tmp5;
- GtkListStore* _tmp4;
- GList* _tmp3;
- GtkTreeModel* _tmp2;
+ GtkListStore* _tmp5_;
+ GtkListStore* _tmp4_;
+ GList* _tmp3_;
+ GtkTreeModel* _tmp2_;
GList* list;
- const GtkTreePath* _tmp6;
+ const GtkTreePath* _tmp6_;
GtkTreePath* path;
g_return_if_fail (self != NULL);
id = 0;
- _tmp0 = NULL;
- selection = (_tmp0 = gtk_tree_view_get_selection (self->priv->treeview), (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
+ _tmp0_ = NULL;
+ selection = (_tmp0_ = gtk_tree_view_get_selection (self->priv->treeview), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
if (gtk_tree_selection_count_selected_rows (selection) > 1) {
(selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL));
return;
}
- _tmp1 = NULL;
- model = (_tmp1 = self->priv->store, (_tmp1 == NULL) ? NULL : g_object_ref (_tmp1));
- _tmp5 = NULL;
- _tmp4 = NULL;
- _tmp3 = NULL;
- _tmp2 = NULL;
- list = (_tmp3 = gtk_tree_selection_get_selected_rows (selection, &_tmp2), model = (_tmp4 = (_tmp5 = (GtkListStore*) _tmp2, (_tmp5 == NULL) ? NULL : g_object_ref (_tmp5)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp4), _tmp3);
+ _tmp1_ = NULL;
+ model = (_tmp1_ = self->priv->store, (_tmp1_ == NULL) ? NULL : g_object_ref (_tmp1_));
+ _tmp5_ = NULL;
+ _tmp4_ = NULL;
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ list = (_tmp3_ = gtk_tree_selection_get_selected_rows (selection, &_tmp2_), model = (_tmp4_ = (_tmp5_ = (GtkListStore*) _tmp2_, (_tmp5_ == NULL) ? NULL : g_object_ref (_tmp5_)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp4_), _tmp3_);
if (g_list_length (list) == 0) {
(selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL));
(model == NULL) ? NULL : (model = (g_object_unref (model), NULL));
(list == NULL) ? NULL : (list = (_g_list_free_gtk_tree_path_free (list), NULL));
return;
}
- _tmp6 = NULL;
- path = (_tmp6 = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp6 == NULL) ? NULL : gtk_tree_path_copy (_tmp6));
+ _tmp6_ = NULL;
+ path = (_tmp6_ = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp6_ == NULL) ? NULL : gtk_tree_path_copy (_tmp6_));
if (gtk_tree_model_get_iter ((GtkTreeModel*) self->priv->store, &iter, path)) {
XfmpcSongDialog* dialog;
gtk_tree_model_get ((GtkTreeModel*) self->priv->store, &iter, XFMPC_PLAYLIST_COLUMNS_COLUMN_ID, &id, -1, -1);
@@ -352,16 +352,16 @@
static void xfmpc_playlist_cb_song_changed (XfmpcPlaylist* self) {
- gboolean _tmp0;
+ gboolean _tmp0_;
g_return_if_fail (self != NULL);
xfmpc_playlist_refresh_current_song (self);
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
if (_vala_strcmp0 (gtk_entry_get_text (xfmpc_playlist_filter_entry), "") == 0) {
- _tmp0 = self->priv->autocenter;
+ _tmp0_ = self->priv->autocenter;
} else {
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
}
- if (_tmp0) {
+ if (_tmp0_) {
xfmpc_playlist_select_row (self, self->priv->current);
}
}
@@ -373,7 +373,7 @@
char* length;
gint id;
gint pos;
- gboolean _tmp0;
+ gboolean _tmp0_;
g_return_if_fail (self != NULL);
filename = g_strdup ("");
song = g_strdup ("");
@@ -386,13 +386,13 @@
xfmpc_playlist_append (self, id, pos, filename, song, length);
}
xfmpc_playlist_refresh_current_song (self);
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
if (_vala_strcmp0 (gtk_entry_get_text (xfmpc_playlist_filter_entry), "") != 0) {
- _tmp0 = self->priv->autocenter;
+ _tmp0_ = self->priv->autocenter;
} else {
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
}
- if (_tmp0) {
+ if (_tmp0_) {
xfmpc_playlist_select_row (self, self->priv->current);
}
filename = (g_free (filename), NULL);
@@ -403,14 +403,14 @@
static void xfmpc_playlist_cb_row_activated (XfmpcPlaylist* self, const GtkTreePath* path, GtkTreeViewColumn* column) {
GtkTreeIter iter = {0};
- const GtkTreePath* _tmp0;
+ const GtkTreePath* _tmp0_;
GtkTreePath* new_path;
gint id;
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (column != NULL);
- _tmp0 = NULL;
- new_path = (_tmp0 = path, (_tmp0 == NULL) ? NULL : gtk_tree_path_copy (_tmp0));
+ _tmp0_ = NULL;
+ new_path = (_tmp0_ = path, (_tmp0_ == NULL) ? NULL : gtk_tree_path_copy (_tmp0_));
id = 0;
if (!gtk_tree_model_get_iter ((GtkTreeModel*) self->priv->filter, &iter, new_path)) {
(new_path == NULL) ? NULL : (new_path = (gtk_tree_path_free (new_path), NULL));
@@ -446,47 +446,47 @@
static gboolean xfmpc_playlist_cb_button_released (XfmpcPlaylist* self, const GdkEventButton* event) {
GtkTreePath* path;
GtkTreeSelection* selection;
- gboolean _tmp0;
- GtkTreeSelection* _tmp3;
- GtkTreeSelection* _tmp2;
+ gboolean _tmp0_;
+ GtkTreeSelection* _tmp3_;
+ GtkTreeSelection* _tmp2_;
gboolean sensitive;
- GtkTreePath* _tmp7;
- gboolean _tmp6;
- GtkTreePath* _tmp5;
- gboolean _tmp8;
+ GtkTreePath* _tmp7_;
+ gboolean _tmp6_;
+ GtkTreePath* _tmp5_;
+ gboolean _tmp8_;
g_return_val_if_fail (self != NULL, FALSE);
path = NULL;
selection = NULL;
- _tmp0 = FALSE;
+ _tmp0_ = FALSE;
if ((*event).type != GDK_BUTTON_PRESS) {
- _tmp0 = TRUE;
+ _tmp0_ = TRUE;
} else {
- _tmp0 = (*event).button != 3;
+ _tmp0_ = (*event).button != 3;
}
- if (_tmp0) {
- gboolean _tmp1;
- return (_tmp1 = FALSE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp1);
+ if (_tmp0_) {
+ gboolean _tmp1_;
+ return (_tmp1_ = FALSE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp1_);
}
- _tmp3 = NULL;
- _tmp2 = NULL;
- selection = (_tmp3 = (_tmp2 = gtk_tree_view_get_selection (self->priv->treeview), (_tmp2 == NULL) ? NULL : g_object_ref (_tmp2)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp3);
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ selection = (_tmp3_ = (_tmp2_ = gtk_tree_view_get_selection (self->priv->treeview), (_tmp2_ == NULL) ? NULL : g_object_ref (_tmp2_)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp3_);
if (gtk_tree_selection_count_selected_rows (selection) < 1) {
- gboolean _tmp4;
- return (_tmp4 = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp4);
+ gboolean _tmp4_;
+ return (_tmp4_ = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp4_);
}
sensitive = gtk_tree_selection_count_selected_rows (selection) == 1;
gtk_widget_set_sensitive ((GtkWidget*) self->priv->mi_browse, sensitive);
gtk_widget_set_sensitive ((GtkWidget*) self->priv->mi_information, sensitive);
- _tmp7 = NULL;
- _tmp5 = NULL;
- if ((_tmp6 = gtk_tree_view_get_path_at_pos (self->priv->treeview, (gint) (*event).x, (gint) (*event).y, &_tmp5, NULL, NULL, NULL), path = (_tmp7 = _tmp5, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp7), _tmp6)) {
+ _tmp7_ = NULL;
+ _tmp5_ = NULL;
+ if ((_tmp6_ = gtk_tree_view_get_path_at_pos (self->priv->treeview, (gint) (*event).x, (gint) (*event).y, &_tmp5_, NULL, NULL, NULL), path = (_tmp7_ = _tmp5_, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp7_), _tmp6_)) {
if (!gtk_tree_selection_path_is_selected (selection, path)) {
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_path (selection, path);
}
}
xfmpc_playlist_menu_popup (self);
- return (_tmp8 = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp8);
+ return (_tmp8_ = TRUE, (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), (selection == NULL) ? NULL : (selection = (g_object_unref (selection), NULL)), _tmp8_);
}
@@ -497,21 +497,21 @@
static void xfmpc_playlist_cb_filter_entry_activated (XfmpcPlaylist* self) {
- GtkTreeModelFilter* _tmp3;
- GtkTreeModelFilter* _tmp2;
- GList* _tmp1;
- GtkTreeModel* _tmp0;
+ GtkTreeModelFilter* _tmp3_;
+ GtkTreeModelFilter* _tmp2_;
+ GList* _tmp1_;
+ GtkTreeModel* _tmp0_;
GList* list;
- const GtkTreePath* _tmp4;
+ const GtkTreePath* _tmp4_;
GtkTreePath* path;
g_return_if_fail (self != NULL);
- _tmp3 = NULL;
- _tmp2 = NULL;
- _tmp1 = NULL;
- _tmp0 = NULL;
- list = (_tmp1 = gtk_tree_selection_get_selected_rows (gtk_tree_view_get_selection (self->priv->treeview), &_tmp0), self->priv->filter = (_tmp2 = (_tmp3 = (GtkTreeModelFilter*) _tmp0, (_tmp3 == NULL) ? NULL : g_object_ref (_tmp3)), (self->priv->filter == NULL) ? NULL : (self->priv->filter = (g_object_unref (self->priv->filter), NULL)), _tmp2), _tmp1);
- _tmp4 = NULL;
- path = (_tmp4 = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp4 == NULL) ? NULL : gtk_tree_path_copy (_tmp4));
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ _tmp1_ = NULL;
+ _tmp0_ = NULL;
+ list = (_tmp1_ = gtk_tree_selection_get_selected_rows (gtk_tree_view_get_selection (self->priv->treeview), &_tmp0_), self->priv->filter = (_tmp2_ = (_tmp3_ = (GtkTreeModelFilter*) _tmp0_, (_tmp3_ == NULL) ? NULL : g_object_ref (_tmp3_)), (self->priv->filter == NULL) ? NULL : (self->priv->filter = (g_object_unref (self->priv->filter), NULL)), _tmp2_), _tmp1_);
+ _tmp4_ = NULL;
+ path = (_tmp4_ = (const GtkTreePath*) g_list_nth_data (list, (guint) 0), (_tmp4_ == NULL) ? NULL : gtk_tree_path_copy (_tmp4_));
if (g_list_length (list) > 0) {
gtk_tree_view_row_activated (self->priv->treeview, path, gtk_tree_view_get_column (self->priv->treeview, 0));
gtk_entry_set_text (xfmpc_playlist_filter_entry, "");
@@ -567,21 +567,21 @@
void xfmpc_playlist_refresh_current_song (XfmpcPlaylist* self) {
GtkTreeIter iter = {0};
GtkTreePath* path;
- GtkTreePath* _tmp0;
- GtkTreePath* _tmp1;
+ GtkTreePath* _tmp0_;
+ GtkTreePath* _tmp1_;
g_return_if_fail (self != NULL);
path = NULL;
if (self->priv->current < 0) {
self->priv->current = 0;
}
- _tmp0 = NULL;
- path = (_tmp0 = gtk_tree_path_new_from_indices (self->priv->current, -1, -1), (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp0);
+ _tmp0_ = NULL;
+ path = (_tmp0_ = gtk_tree_path_new_from_indices (self->priv->current, -1, -1), (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp0_);
if (gtk_tree_model_get_iter ((GtkTreeModel*) self->priv->store, &iter, path)) {
gtk_list_store_set (self->priv->store, &iter, XFMPC_PLAYLIST_COLUMNS_COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL, -1, -1);
}
self->priv->current = xfmpc_mpdclient_get_pos (self->priv->mpdclient);
- _tmp1 = NULL;
- path = (_tmp1 = gtk_tree_path_new_from_indices (self->priv->current, -1, -1), (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp1);
+ _tmp1_ = NULL;
+ path = (_tmp1_ = gtk_tree_path_new_from_indices (self->priv->current, -1, -1), (path == NULL) ? NULL : (path = (gtk_tree_path_free (path), NULL)), _tmp1_);
if (gtk_tree_model_get_iter ((GtkTreeModel*) self->priv->store, &iter, path)) {
gtk_list_store_set (self->priv->store, &iter, XFMPC_PLAYLIST_COLUMNS_COLUMN_WEIGHT, PANGO_WEIGHT_BOLD, -1, -1);
}
@@ -608,31 +608,31 @@
void xfmpc_playlist_delete_selection (XfmpcPlaylist* self) {
gint id;
GtkTreeIter iter = {0};
- GtkListStore* _tmp0;
+ GtkListStore* _tmp0_;
GtkListStore* model;
- GtkListStore* _tmp4;
- GtkListStore* _tmp3;
- GList* _tmp2;
- GtkTreeModel* _tmp1;
+ GtkListStore* _tmp4_;
+ GtkListStore* _tmp3_;
+ GList* _tmp2_;
+ GtkTreeModel* _tmp1_;
GList* list;
g_return_if_fail (self != NULL);
id = 0;
- _tmp0 = NULL;
- model = (_tmp0 = self->priv->store, (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
- _tmp4 = NULL;
- _tmp3 = NULL;
- _tmp2 = NULL;
- _tmp1 = NULL;
- list = (_tmp2 = gtk_tree_selection_get_selected_rows (gtk_tree_view_get_selection (self->priv->treeview), &_tmp1), model = (_tmp3 = (_tmp4 = (GtkListStore*) _tmp1, (_tmp4 == NULL) ? NULL : g_object_ref (_tmp4)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp3), _tmp2);
+ _tmp0_ = NULL;
+ model = (_tmp0_ = self->priv->store, (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
+ _tmp4_ = NULL;
+ _tmp3_ = NULL;
+ _tmp2_ = NULL;
+ _tmp1_ = NULL;
+ list = (_tmp2_ = gtk_tree_selection_get_selected_rows (gtk_tree_view_get_selection (self->priv->treeview), &_tmp1_), model = (_tmp3_ = (_tmp4_ = (GtkListStore*) _tmp1_, (_tmp4_ == NULL) ? NULL : g_object_ref (_tmp4_)), (model == NULL) ? NULL : (model = (g_object_unref (model), NULL)), _tmp3_), _tmp2_);
{
GList* path_collection;
GList* path_it;
path_collection = list;
for (path_it = path_collection; path_it != NULL; path_it = path_it->next) {
- const GtkTreePath* _tmp5;
+ const GtkTreePath* _tmp5_;
GtkTreePath* path;
- _tmp5 = NULL;
- path = (_tmp5 = (const GtkTreePath*) path_it->data, (_tmp5 == NULL) ? NULL : gtk_tree_path_copy (_tmp5));
+ _tmp5_ = NULL;
+ path = (_tmp5_ = (const GtkTreePath*) path_it->data, (_tmp5_ == NULL) ? NULL : gtk_tree_path_copy (_tmp5_));
{
if (gtk_tree_model_get_iter ((GtkTreeModel*) self->priv->store, &iter, path)) {
gtk_tree_model_get ((GtkTreeModel*) self->priv->store, &iter, XFMPC_PLAYLIST_COLUMNS_COLUMN_ID, &id, -1, -1);
@@ -735,34 +735,34 @@
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = XFMPC_PLAYLIST (obj);
{
- GtkListStore* _tmp0;
- GtkTreeModelFilter* _tmp1;
- GtkTreeView* _tmp2;
+ GtkListStore* _tmp0_;
+ GtkTreeModelFilter* _tmp1_;
+ GtkTreeView* _tmp2_;
GtkCellRendererText* cell;
- GtkCellRendererText* _tmp3;
+ GtkCellRendererText* _tmp3_;
GtkTreeViewColumn* column;
- GtkCellRendererText* _tmp4;
- GtkAdjustment* _tmp6;
- GtkAdjustment* _tmp5;
- GtkScrolledWindow* _tmp7;
+ GtkCellRendererText* _tmp4_;
+ GtkAdjustment* _tmp6_;
+ GtkAdjustment* _tmp5_;
+ GtkScrolledWindow* _tmp7_;
GtkScrolledWindow* scrolled;
- GtkMenu* _tmp8;
+ GtkMenu* _tmp8_;
GtkImageMenuItem* mi;
- GtkImageMenuItem* _tmp9;
+ GtkImageMenuItem* _tmp9_;
GtkImage* image;
- GtkImageMenuItem* _tmp10;
- GtkEntry* _tmp11;
+ GtkImageMenuItem* _tmp10_;
+ GtkEntry* _tmp11_;
xfce_textdomain (self->priv->gettext_package, self->priv->localedir, "UTF-8");
self->priv->mpdclient = xfmpc_mpdclient_get ();
self->priv->preferences = xfmpc_preferences_get ();
self->priv->autocenter = xfmpc_preferences_get_playlist_autocenter (self->priv->preferences);
- _tmp0 = NULL;
- self->priv->store = (_tmp0 = gtk_list_store_new ((gint) XFMPC_PLAYLIST_COLUMNS_N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, NULL), (self->priv->store == NULL) ? NULL : (self->priv->store = (g_object_unref (self->priv->store), NULL)), _tmp0);
- _tmp1 = NULL;
- self->priv->filter = (_tmp1 = (GtkTreeModelFilter*) gtk_tree_model_filter_new ((GtkTreeModel*) self->priv->store, NULL), (self->priv->filter == NULL) ? NULL : (self->priv->filter = (g_object_unref (self->priv->filter), NULL)), _tmp1);
+ _tmp0_ = NULL;
+ self->priv->store = (_tmp0_ = gtk_list_store_new ((gint) XFMPC_PLAYLIST_COLUMNS_N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, NULL), (self->priv->store == NULL) ? NULL : (self->priv->store = (g_object_unref (self->priv->store), NULL)), _tmp0_);
+ _tmp1_ = NULL;
+ self->priv->filter = (_tmp1_ = (GtkTreeModelFilter*) gtk_tree_model_filter_new ((GtkTreeModel*) self->priv->store, NULL), (self->priv->filter == NULL) ? NULL : (self->priv->filter = (g_object_unref (self->priv->filter), NULL)), _tmp1_);
gtk_tree_model_filter_set_visible_func (self->priv->filter, (GtkTreeModelFilterVisibleFunc) xfmpc_playlist_visible_func_filter_tree, NULL, NULL);
- _tmp2 = NULL;
- self->priv->treeview = (_tmp2 = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()), (self->priv->treeview == NULL) ? NULL : (self->priv->treeview = (g_object_unref (self->priv->treeview), NULL)), _tmp2);
+ _tmp2_ = NULL;
+ self->priv->treeview = (_tmp2_ = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()), (self->priv->treeview == NULL) ? NULL : (self->priv->treeview = (g_object_unref (self->priv->treeview), NULL)), _tmp2_);
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, FALSE);
@@ -772,39 +772,39 @@
cell = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ());
g_object_set ((GtkCellRenderer*) cell, "xalign", (float) 1, NULL);
gtk_tree_view_insert_column_with_attributes (self->priv->treeview, -1, "Length", (GtkCellRenderer*) cell, "text", XFMPC_PLAYLIST_COLUMNS_COLUMN_POSITION, "weight", XFMPC_PLAYLIST_COLUMNS_COLUMN_WEIGHT, NULL, NULL);
- _tmp3 = NULL;
- cell = (_tmp3 = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ()), (cell == NULL) ? NULL : (cell = (g_object_unref (cell), NULL)), _tmp3);
+ _tmp3_ = NULL;
+ cell = (_tmp3_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ()), (cell == NULL) ? NULL : (cell = (g_object_unref (cell), NULL)), _tmp3_);
g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
column = g_object_ref_sink (gtk_tree_view_column_new_with_attributes ("Song", (GtkCellRenderer*) cell, "text", XFMPC_PLAYLIST_COLUMNS_COLUMN_SONG, "weight", XFMPC_PLAYLIST_COLUMNS_COLUMN_WEIGHT, NULL, NULL));
gtk_tree_view_column_set_expand (column, TRUE);
gtk_tree_view_append_column (self->priv->treeview, column);
- _tmp4 = NULL;
- cell = (_tmp4 = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ()), (cell == NULL) ? NULL : (cell = (g_object_unref (cell), NULL)), _tmp4);
+ _tmp4_ = NULL;
+ cell = (_tmp4_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ()), (cell == NULL) ? NULL : (cell = (g_object_unref (cell), NULL)), _tmp4_);
g_object_set ((GtkCellRenderer*) cell, "xalign", (float) 1, NULL);
gtk_tree_view_insert_column_with_attributes (self->priv->treeview, -1, "Length", (GtkCellRenderer*) cell, "text", XFMPC_PLAYLIST_COLUMNS_COLUMN_LENGTH, "weight", XFMPC_PLAYLIST_COLUMNS_COLUMN_WEIGHT, NULL, NULL);
- _tmp6 = NULL;
- _tmp5 = NULL;
- _tmp7 = NULL;
- scrolled = (_tmp7 = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (_tmp5 = g_object_ref_sink ((GtkAdjustment*) gtk_adjustment_new ((double) 0, (double) 0, (double) 0, (double) 0, (double) 0, (double) 0)), _tmp6 = g_object_ref_sink ((GtkAdjustment*) gtk_adjustment_new ((double) 0, (double) 0, (double) 0, (double) 0, (double) 0, (double) 0)))), (_tmp6 == NULL) ? NULL : (_tmp6 = (g_object_unref (_tmp6), NULL)), (_tmp5 == NULL) ? NULL : (_tmp5 = (g_object_unref (_tmp5), NULL)), _tmp7);
+ _tmp6_ = NULL;
+ _tmp5_ = NULL;
+ _tmp7_ = NULL;
+ scrolled = (_tmp7_ = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (_tmp5_ = g_object_ref_sink ((GtkAdjustment*) gtk_adjustment_new ((double) 0, (double) 0, (double) 0, (double) 0, (double) 0, (double) 0)), _tmp6_ = g_object_ref_sink ((GtkAdjustment*) gtk_adjustment_new ((double) 0, (double) 0, (double) 0, (double) 0, (double) 0, (double) 0)))), (_tmp6_ == NULL) ? NULL : (_tmp6_ = (g_object_unref (_tmp6_), NULL)), (_tmp5_ == NULL) ? NULL : (_tmp5_ = (g_object_unref (_tmp5_), NULL)), _tmp7_);
gtk_scrolled_window_set_policy (scrolled, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- _tmp8 = NULL;
- self->priv->menu = (_tmp8 = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), (self->priv->menu == NULL) ? NULL : (self->priv->menu = (g_object_unref (self->priv->menu), NULL)), _tmp8);
+ _tmp8_ = NULL;
+ self->priv->menu = (_tmp8_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), (self->priv->menu == NULL) ? NULL : (self->priv->menu = (g_object_unref (self->priv->menu), NULL)), _tmp8_);
mi = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_REMOVE, NULL));
gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) mi));
g_signal_connect_object ((GtkMenuItem*) mi, "activate", (GCallback) _xfmpc_playlist_delete_selection_gtk_menu_item_activate, self, 0);
- _tmp9 = NULL;
- self->priv->mi_browse = (_tmp9 = 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)), _tmp9);
+ _tmp9_ = NULL;
+ self->priv->mi_browse = (_tmp9_ = 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)), _tmp9_);
image = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
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_playlist_cb_browse_selection_gtk_menu_item_activate, self, 0);
- _tmp10 = NULL;
- self->priv->mi_information = (_tmp10 = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_INFO, NULL)), (self->priv->mi_information == NULL) ? NULL : (self->priv->mi_information = (g_object_unref (self->priv->mi_information), NULL)), _tmp10);
+ _tmp10_ = NULL;
+ self->priv->mi_information = (_tmp10_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_INFO, NULL)), (self->priv->mi_information == NULL) ? NULL : (self->priv->mi_information = (g_object_unref (self->priv->mi_information), NULL)), _tmp10_);
gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) self->priv->mi_information));
g_signal_connect_object ((GtkMenuItem*) self->priv->mi_information, "activate", (GCallback) _xfmpc_playlist_cb_info_selection_gtk_menu_item_activate, self, 0);
gtk_widget_show_all ((GtkWidget*) self->priv->menu);
- _tmp11 = NULL;
- xfmpc_playlist_filter_entry = (_tmp11 = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (xfmpc_playlist_filter_entry == NULL) ? NULL : (xfmpc_playlist_filter_entry = (g_object_unref (xfmpc_playlist_filter_entry), NULL)), _tmp11);
+ _tmp11_ = NULL;
+ xfmpc_playlist_filter_entry = (_tmp11_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (xfmpc_playlist_filter_entry == NULL) ? NULL : (xfmpc_playlist_filter_entry = (g_object_unref (xfmpc_playlist_filter_entry), NULL)), _tmp11_);
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*) xfmpc_playlist_filter_entry, FALSE, FALSE, (guint) 0);
Modified: xfmpc/trunk/src/preferences-dialog.c
===================================================================
--- xfmpc/trunk/src/preferences-dialog.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/preferences-dialog.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -121,17 +121,17 @@
static void xfmpc_preferences_dialog_cb_update_mpd (XfmpcPreferencesDialog* self, GtkButton* source) {
XfmpcMpdclient* mpdclient;
- const char* _tmp0;
+ const char* _tmp0_;
char* mpd_hostname;
- const char* _tmp1;
+ 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));
+ _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_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);
@@ -215,14 +215,14 @@
static gboolean xfmpc_preferences_dialog_timeout_format (XfmpcPreferencesDialog* self) {
- const char* _tmp0;
+ const char* _tmp0_;
char* custom_format;
- gboolean _tmp1;
+ gboolean _tmp1_;
g_return_val_if_fail (self != NULL, FALSE);
- _tmp0 = NULL;
- custom_format = (_tmp0 = gtk_entry_get_text (self->priv->entry_custom), (_tmp0 == NULL) ? NULL : g_strdup (_tmp0));
+ _tmp0_ = NULL;
+ custom_format = (_tmp0_ = gtk_entry_get_text (self->priv->entry_custom), (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_));
xfmpc_preferences_set_song_format_custom (self->priv->preferences, custom_format);
- return (_tmp1 = FALSE, custom_format = (g_free (custom_format), NULL), _tmp1);
+ return (_tmp1_ = FALSE, custom_format = (g_free (custom_format), NULL), _tmp1_);
}
@@ -282,45 +282,45 @@
GtkVBox* vbox;
GtkLabel* label;
GtkVBox* vbox2;
- GtkWidget* _tmp0;
+ GtkWidget* _tmp0_;
GtkWidget* frame;
- GtkCheckButton* _tmp1;
- GtkVBox* _tmp2;
+ GtkCheckButton* _tmp1_;
+ GtkVBox* _tmp2_;
GtkHBox* hbox;
- GtkLabel* _tmp3;
- GtkEntry* _tmp4;
- GtkLabel* _tmp5;
- GtkSpinButton* _tmp6;
- GtkHBox* _tmp7;
- GtkLabel* _tmp8;
- GtkEntry* _tmp9;
+ GtkLabel* _tmp3_;
+ GtkEntry* _tmp4_;
+ GtkLabel* _tmp5_;
+ GtkSpinButton* _tmp6_;
+ GtkHBox* _tmp7_;
+ GtkLabel* _tmp8_;
+ GtkEntry* _tmp9_;
GtkButton* button;
- GtkVBox* _tmp10;
- GtkLabel* _tmp11;
- GtkVBox* _tmp12;
- GtkWidget* _tmp14;
- GtkWidget* _tmp13;
- GtkCheckButton* _tmp15;
- GtkVBox* _tmp16;
- GtkWidget* _tmp18;
- GtkWidget* _tmp17;
- GtkHBox* _tmp19;
- GtkLabel* _tmp20;
- GtkComboBox* _tmp21;
- GtkHBox* _tmp22;
- GtkLabel* _tmp23;
- GtkEntry* _tmp24;
- GtkLabel* _tmp25;
+ GtkVBox* _tmp10_;
+ GtkLabel* _tmp11_;
+ GtkVBox* _tmp12_;
+ GtkWidget* _tmp14_;
+ GtkWidget* _tmp13_;
+ GtkCheckButton* _tmp15_;
+ GtkVBox* _tmp16_;
+ GtkWidget* _tmp18_;
+ GtkWidget* _tmp17_;
+ GtkHBox* _tmp19_;
+ GtkLabel* _tmp20_;
+ GtkComboBox* _tmp21_;
+ GtkHBox* _tmp22_;
+ GtkLabel* _tmp23_;
+ GtkEntry* _tmp24_;
+ GtkLabel* _tmp25_;
GtkTable* table;
PangoAttrList* attrs;
- GtkLabel* _tmp26;
- GtkLabel* _tmp27;
- GtkLabel* _tmp28;
- GtkLabel* _tmp29;
- GtkLabel* _tmp30;
- GtkLabel* _tmp31;
- GtkLabel* _tmp32;
- GtkLabel* _tmp33;
+ GtkLabel* _tmp26_;
+ GtkLabel* _tmp27_;
+ GtkLabel* _tmp28_;
+ GtkLabel* _tmp29_;
+ GtkLabel* _tmp30_;
+ GtkLabel* _tmp31_;
+ GtkLabel* _tmp32_;
+ GtkLabel* _tmp33_;
xfce_textdomain (self->priv->gettext_package, self->priv->localedir, "UTF-8");
gtk_dialog_set_has_separator ((GtkDialog*) self, TRUE);
gtk_window_set_skip_taskbar_hint ((GtkWindow*) self, TRUE);
@@ -337,45 +337,45 @@
label = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("MPD")));
gtk_notebook_append_page (notebook, (GtkWidget*) vbox, (GtkWidget*) label);
vbox2 = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6));
- _tmp0 = NULL;
- frame = (_tmp0 = xfce_create_framebox_with_content (_ ("Connection"), (GtkWidget*) vbox2), (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
+ _tmp0_ = NULL;
+ frame = (_tmp0_ = xfce_create_framebox_with_content (_ ("Connection"), (GtkWidget*) vbox2), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
gtk_box_pack_start ((GtkBox*) vbox, frame, FALSE, FALSE, (guint) 0);
- _tmp1 = NULL;
- self->priv->entry_use_defaults = (_tmp1 = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Use _default system settings"))), (self->priv->entry_use_defaults == NULL) ? NULL : (self->priv->entry_use_defaults = (g_object_unref (self->priv->entry_use_defaults), NULL)), _tmp1);
+ _tmp1_ = NULL;
+ self->priv->entry_use_defaults = (_tmp1_ = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Use _default system settings"))), (self->priv->entry_use_defaults == NULL) ? NULL : (self->priv->entry_use_defaults = (g_object_unref (self->priv->entry_use_defaults), NULL)), _tmp1_);
gtk_widget_set_tooltip_text ((GtkWidget*) self->priv->entry_use_defaults, _ ("If checked, Xfmpc will try to read the environment variables MPD_HOST and MPD_PORT otherwise it will use localhost"));
gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->entry_use_defaults, xfmpc_preferences_get_mpd_use_defaults (self->priv->preferences));
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) self->priv->entry_use_defaults, FALSE, FALSE, (guint) 0);
- _tmp2 = NULL;
- self->priv->mpd_vbox = (_tmp2 = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (self->priv->mpd_vbox == NULL) ? NULL : (self->priv->mpd_vbox = (g_object_unref (self->priv->mpd_vbox), NULL)), _tmp2);
+ _tmp2_ = NULL;
+ self->priv->mpd_vbox = (_tmp2_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (self->priv->mpd_vbox == NULL) ? NULL : (self->priv->mpd_vbox = (g_object_unref (self->priv->mpd_vbox), NULL)), _tmp2_);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) self->priv->mpd_vbox, FALSE, FALSE, (guint) 0);
g_signal_connect_object ((GtkToggleButton*) self->priv->entry_use_defaults, "toggled", (GCallback) _xfmpc_preferences_dialog_cb_use_defaults_toggled_gtk_toggle_button_toggled, self, 0);
gtk_widget_set_sensitive ((GtkWidget*) self->priv->mpd_vbox, !gtk_toggle_button_get_active ((GtkToggleButton*) self->priv->entry_use_defaults));
hbox = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 2));
gtk_box_pack_start ((GtkBox*) self->priv->mpd_vbox, (GtkWidget*) hbox, FALSE, FALSE, (guint) 0);
- _tmp3 = NULL;
- label = (_tmp3 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Hostname:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp3);
+ _tmp3_ = NULL;
+ label = (_tmp3_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Hostname:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp3_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 0);
- _tmp4 = NULL;
- self->priv->entry_host = (_tmp4 = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->entry_host == NULL) ? NULL : (self->priv->entry_host = (g_object_unref (self->priv->entry_host), NULL)), _tmp4);
+ _tmp4_ = NULL;
+ self->priv->entry_host = (_tmp4_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->entry_host == NULL) ? NULL : (self->priv->entry_host = (g_object_unref (self->priv->entry_host), NULL)), _tmp4_);
gtk_entry_set_width_chars (self->priv->entry_host, 15);
gtk_entry_set_text (self->priv->entry_host, xfmpc_preferences_get_mpd_hostname (self->priv->preferences));
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) self->priv->entry_host, TRUE, TRUE, (guint) 0);
- _tmp5 = NULL;
- label = (_tmp5 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Port:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp5);
+ _tmp5_ = NULL;
+ label = (_tmp5_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Port:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp5_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 0);
- _tmp6 = NULL;
- self->priv->entry_port = (_tmp6 = g_object_ref_sink ((GtkSpinButton*) gtk_spin_button_new_with_range ((double) 0, (double) 65536, (double) 1)), (self->priv->entry_port == NULL) ? NULL : (self->priv->entry_port = (g_object_unref (self->priv->entry_port), NULL)), _tmp6);
+ _tmp6_ = NULL;
+ self->priv->entry_port = (_tmp6_ = g_object_ref_sink ((GtkSpinButton*) gtk_spin_button_new_with_range ((double) 0, (double) 65536, (double) 1)), (self->priv->entry_port == NULL) ? NULL : (self->priv->entry_port = (g_object_unref (self->priv->entry_port), NULL)), _tmp6_);
gtk_spin_button_set_digits (self->priv->entry_port, (guint) 0);
gtk_spin_button_set_value (self->priv->entry_port, (double) xfmpc_preferences_get_mpd_port (self->priv->preferences));
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) self->priv->entry_port, TRUE, TRUE, (guint) 0);
- _tmp7 = NULL;
- hbox = (_tmp7 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 2)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp7);
+ _tmp7_ = NULL;
+ hbox = (_tmp7_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 2)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp7_);
gtk_box_pack_start ((GtkBox*) self->priv->mpd_vbox, (GtkWidget*) hbox, FALSE, FALSE, (guint) 0);
- _tmp8 = NULL;
- label = (_tmp8 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Password:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp8);
+ _tmp8_ = NULL;
+ label = (_tmp8_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Password:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp8_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 0);
- _tmp9 = NULL;
- self->priv->entry_passwd = (_tmp9 = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->entry_passwd == NULL) ? NULL : (self->priv->entry_passwd = (g_object_unref (self->priv->entry_passwd), NULL)), _tmp9);
+ _tmp9_ = NULL;
+ self->priv->entry_passwd = (_tmp9_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->entry_passwd == NULL) ? NULL : (self->priv->entry_passwd = (g_object_unref (self->priv->entry_passwd), NULL)), _tmp9_);
gtk_entry_set_visibility (self->priv->entry_passwd, FALSE);
if (xfmpc_preferences_get_mpd_password (self->priv->preferences) != NULL) {
gtk_entry_set_text (self->priv->entry_passwd, xfmpc_preferences_get_mpd_password (self->priv->preferences));
@@ -385,36 +385,36 @@
g_signal_connect_object (button, "clicked", (GCallback) _xfmpc_preferences_dialog_cb_update_mpd_gtk_button_clicked, self, 0);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) button, TRUE, TRUE, (guint) 0);
/* Display */
- _tmp10 = NULL;
- vbox = (_tmp10 = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (vbox == NULL) ? NULL : (vbox = (g_object_unref (vbox), NULL)), _tmp10);
+ _tmp10_ = NULL;
+ vbox = (_tmp10_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (vbox == NULL) ? NULL : (vbox = (g_object_unref (vbox), NULL)), _tmp10_);
gtk_container_set_border_width ((GtkContainer*) vbox, (guint) 6);
- _tmp11 = NULL;
- label = (_tmp11 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Appearance"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp11);
+ _tmp11_ = NULL;
+ label = (_tmp11_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Appearance"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp11_);
gtk_notebook_append_page (notebook, (GtkWidget*) vbox, (GtkWidget*) label);
- _tmp12 = NULL;
- vbox2 = (_tmp12 = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (vbox2 == NULL) ? NULL : (vbox2 = (g_object_unref (vbox2), NULL)), _tmp12);
- _tmp14 = NULL;
- _tmp13 = NULL;
- frame = (_tmp14 = (_tmp13 = xfce_create_framebox_with_content (_ ("Statusbar"), (GtkWidget*) vbox2), (_tmp13 == NULL) ? NULL : g_object_ref (_tmp13)), (frame == NULL) ? NULL : (frame = (g_object_unref (frame), NULL)), _tmp14);
+ _tmp12_ = NULL;
+ vbox2 = (_tmp12_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (vbox2 == NULL) ? NULL : (vbox2 = (g_object_unref (vbox2), NULL)), _tmp12_);
+ _tmp14_ = NULL;
+ _tmp13_ = NULL;
+ frame = (_tmp14_ = (_tmp13_ = xfce_create_framebox_with_content (_ ("Statusbar"), (GtkWidget*) vbox2), (_tmp13_ == NULL) ? NULL : g_object_ref (_tmp13_)), (frame == NULL) ? NULL : (frame = (g_object_unref (frame), NULL)), _tmp14_);
gtk_box_pack_start ((GtkBox*) vbox, frame, FALSE, FALSE, (guint) 0);
- _tmp15 = NULL;
- self->priv->show_statusbar = (_tmp15 = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Show _stastusbar"))), (self->priv->show_statusbar == NULL) ? NULL : (self->priv->show_statusbar = (g_object_unref (self->priv->show_statusbar), NULL)), _tmp15);
+ _tmp15_ = NULL;
+ self->priv->show_statusbar = (_tmp15_ = g_object_ref_sink ((GtkCheckButton*) gtk_check_button_new_with_mnemonic (_ ("Show _stastusbar"))), (self->priv->show_statusbar == NULL) ? NULL : (self->priv->show_statusbar = (g_object_unref (self->priv->show_statusbar), NULL)), _tmp15_);
gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->show_statusbar, xfmpc_preferences_get_show_statusbar (self->priv->preferences));
g_signal_connect_object ((GtkToggleButton*) self->priv->show_statusbar, "toggled", (GCallback) _xfmpc_preferences_dialog_cb_show_statusbar_toggled_gtk_toggle_button_toggled, self, 0);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) self->priv->show_statusbar, FALSE, FALSE, (guint) 0);
- _tmp16 = NULL;
- vbox2 = (_tmp16 = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (vbox2 == NULL) ? NULL : (vbox2 = (g_object_unref (vbox2), NULL)), _tmp16);
- _tmp18 = NULL;
- _tmp17 = NULL;
- frame = (_tmp18 = (_tmp17 = xfce_create_framebox_with_content (_ ("Song Format"), (GtkWidget*) vbox2), (_tmp17 == NULL) ? NULL : g_object_ref (_tmp17)), (frame == NULL) ? NULL : (frame = (g_object_unref (frame), NULL)), _tmp18);
+ _tmp16_ = NULL;
+ vbox2 = (_tmp16_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 6)), (vbox2 == NULL) ? NULL : (vbox2 = (g_object_unref (vbox2), NULL)), _tmp16_);
+ _tmp18_ = NULL;
+ _tmp17_ = NULL;
+ frame = (_tmp18_ = (_tmp17_ = xfce_create_framebox_with_content (_ ("Song Format"), (GtkWidget*) vbox2), (_tmp17_ == NULL) ? NULL : g_object_ref (_tmp17_)), (frame == NULL) ? NULL : (frame = (g_object_unref (frame), NULL)), _tmp18_);
gtk_box_pack_start ((GtkBox*) vbox, frame, FALSE, FALSE, (guint) 0);
- _tmp19 = NULL;
- hbox = (_tmp19 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 2)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp19);
- _tmp20 = NULL;
- label = (_tmp20 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Song Format:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp20);
+ _tmp19_ = NULL;
+ hbox = (_tmp19_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 2)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp19_);
+ _tmp20_ = NULL;
+ label = (_tmp20_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Song Format:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp20_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 0);
- _tmp21 = NULL;
- self->priv->combo_format = (_tmp21 = g_object_ref_sink ((GtkComboBox*) gtk_combo_box_new_text ()), (self->priv->combo_format == NULL) ? NULL : (self->priv->combo_format = (g_object_unref (self->priv->combo_format), NULL)), _tmp21);
+ _tmp21_ = NULL;
+ self->priv->combo_format = (_tmp21_ = g_object_ref_sink ((GtkComboBox*) gtk_combo_box_new_text ()), (self->priv->combo_format == NULL) ? NULL : (self->priv->combo_format = (g_object_unref (self->priv->combo_format), NULL)), _tmp21_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) self->priv->combo_format, TRUE, TRUE, (guint) 0);
gtk_combo_box_append_text (self->priv->combo_format, _ ("Title"));
gtk_combo_box_append_text (self->priv->combo_format, _ ("Album - Title"));
@@ -425,13 +425,13 @@
gtk_combo_box_append_text (self->priv->combo_format, _ ("Custom..."));
gtk_combo_box_set_active (self->priv->combo_format, xfmpc_preferences_get_song_format (self->priv->preferences));
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, TRUE, TRUE, (guint) 0);
- _tmp22 = NULL;
- hbox = (_tmp22 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 2)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp22);
- _tmp23 = NULL;
- label = (_tmp23 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Custom format:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp23);
+ _tmp22_ = NULL;
+ hbox = (_tmp22_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 2)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp22_);
+ _tmp23_ = NULL;
+ label = (_tmp23_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Custom format:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp23_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 0);
- _tmp24 = NULL;
- self->priv->entry_custom = (_tmp24 = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->entry_custom == NULL) ? NULL : (self->priv->entry_custom = (g_object_unref (self->priv->entry_custom), NULL)), _tmp24);
+ _tmp24_ = NULL;
+ self->priv->entry_custom = (_tmp24_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), (self->priv->entry_custom == NULL) ? NULL : (self->priv->entry_custom = (g_object_unref (self->priv->entry_custom), NULL)), _tmp24_);
gtk_entry_set_width_chars (self->priv->entry_custom, 15);
gtk_entry_set_max_length (self->priv->entry_custom, 30);
gtk_entry_set_text (self->priv->entry_custom, xfmpc_preferences_get_song_format_custom (self->priv->preferences));
@@ -440,49 +440,49 @@
g_signal_connect_object (self->priv->combo_format, "changed", (GCallback) _xfmpc_preferences_dialog_cb_combo_format_changed_gtk_combo_box_changed, self, 0);
g_signal_connect_object ((GtkEditable*) self->priv->entry_custom, "changed", (GCallback) _xfmpc_preferences_dialog_cb_entry_custom_changed_gtk_editable_changed, self, 0);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, TRUE, TRUE, (guint) 0);
- _tmp25 = NULL;
- label = (_tmp25 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Available parameters:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp25);
+ _tmp25_ = NULL;
+ label = (_tmp25_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Available parameters:"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp25_);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) label, TRUE, TRUE, (guint) 0);
table = g_object_ref_sink ((GtkTable*) gtk_table_new ((guint) 4, (guint) 6, TRUE));
attrs = pango_attr_list_new ();
pango_attr_list_insert (attrs, pango_attr_scale_new ((double) PANGO_SCALE_SMALL));
- _tmp26 = NULL;
- label = (_tmp26 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%a: Artist"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp26);
+ _tmp26_ = NULL;
+ label = (_tmp26_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%a: Artist"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp26_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 1, (guint) 3, (guint) 0, (guint) 1);
- _tmp27 = NULL;
- label = (_tmp27 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%A: Album"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp27);
+ _tmp27_ = NULL;
+ label = (_tmp27_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%A: Album"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp27_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 4, (guint) 6, (guint) 0, (guint) 1);
- _tmp28 = NULL;
- label = (_tmp28 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%d: Date"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp28);
+ _tmp28_ = NULL;
+ label = (_tmp28_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%d: Date"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp28_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 1, (guint) 3, (guint) 1, (guint) 2);
- _tmp29 = NULL;
- label = (_tmp29 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%D: Disc"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp29);
+ _tmp29_ = NULL;
+ label = (_tmp29_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%D: Disc"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp29_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 4, (guint) 6, (guint) 1, (guint) 2);
- _tmp30 = NULL;
- label = (_tmp30 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%f: File"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp30);
+ _tmp30_ = NULL;
+ label = (_tmp30_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%f: File"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp30_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 1, (guint) 3, (guint) 2, (guint) 3);
- _tmp31 = NULL;
- label = (_tmp31 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%g: Genre"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp31);
+ _tmp31_ = NULL;
+ label = (_tmp31_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%g: Genre"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp31_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 4, (guint) 6, (guint) 2, (guint) 3);
- _tmp32 = NULL;
- label = (_tmp32 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%t: Title"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp32);
+ _tmp32_ = NULL;
+ label = (_tmp32_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%t: Title"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp32_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 1, (guint) 3, (guint) 3, (guint) 4);
- _tmp33 = NULL;
- label = (_tmp33 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%T: Track"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp33);
+ _tmp33_ = NULL;
+ label = (_tmp33_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("%T: Track"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp33_);
gtk_label_set_attributes (label, attrs);
gtk_misc_set_alignment ((GtkMisc*) label, (float) 0, (float) 0.5);
gtk_table_attach_defaults (table, (GtkWidget*) label, (guint) 4, (guint) 6, (guint) 3, (guint) 4);
Modified: xfmpc/trunk/src/song-dialog.c
===================================================================
--- xfmpc/trunk/src/song-dialog.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/song-dialog.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -82,30 +82,30 @@
XfmpcSongDialog* xfmpc_song_dialog_construct (GType object_type, gint song_id) {
XfmpcSongDialog * self;
GtkVBox* vbox2;
- GtkWidget* _tmp0;
+ GtkWidget* _tmp0_;
GtkWidget* frame;
PangoAttrList* attrs;
GtkHBox* hbox;
GtkLabel* label;
- GtkLabel* _tmp2;
- char* _tmp1;
- GtkHBox* _tmp3;
- GtkLabel* _tmp4;
- GtkLabel* _tmp5;
- GtkHBox* _tmp6;
- GtkLabel* _tmp7;
- GtkLabel* _tmp8;
- GtkHBox* _tmp9;
- GtkLabel* _tmp10;
- GtkLabel* _tmp11;
- GtkHBox* _tmp12;
- GtkLabel* _tmp13;
- GtkLabel* _tmp14;
- GtkLabel* _tmp15;
- GtkLabel* _tmp16;
- GtkHBox* _tmp17;
- GtkLabel* _tmp18;
- GtkLabel* _tmp19;
+ GtkLabel* _tmp2_;
+ char* _tmp1_;
+ GtkHBox* _tmp3_;
+ GtkLabel* _tmp4_;
+ GtkLabel* _tmp5_;
+ GtkHBox* _tmp6_;
+ GtkLabel* _tmp7_;
+ GtkLabel* _tmp8_;
+ GtkHBox* _tmp9_;
+ GtkLabel* _tmp10_;
+ GtkLabel* _tmp11_;
+ GtkHBox* _tmp12_;
+ GtkLabel* _tmp13_;
+ GtkLabel* _tmp14_;
+ GtkLabel* _tmp15_;
+ GtkLabel* _tmp16_;
+ GtkHBox* _tmp17_;
+ GtkLabel* _tmp18_;
+ GtkLabel* _tmp19_;
self = g_object_newv (object_type, 0, NULL);
xfce_textdomain (self->priv->gettext_package, self->priv->localedir, "UTF-8");
gtk_dialog_set_has_separator ((GtkDialog*) self, TRUE);
@@ -117,75 +117,75 @@
gtk_window_set_title ((GtkWindow*) self, self->priv->song->title);
gtk_box_set_spacing ((GtkBox*) ((GtkDialog*) self)->vbox, 0);
vbox2 = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 0));
- _tmp0 = NULL;
- frame = (_tmp0 = xfce_create_framebox_with_content ("", (GtkWidget*) vbox2), (_tmp0 == NULL) ? NULL : g_object_ref (_tmp0));
+ _tmp0_ = NULL;
+ frame = (_tmp0_ = xfce_create_framebox_with_content ("", (GtkWidget*) vbox2), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
attrs = pango_attr_list_new ();
pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
hbox = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0));
label = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("File")));
gtk_label_set_attributes (label, attrs);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
- _tmp2 = NULL;
- _tmp1 = NULL;
- label = (_tmp2 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_tmp1 = g_path_get_basename (self->priv->song->filename))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp2);
- _tmp1 = (g_free (_tmp1), NULL);
+ _tmp2_ = NULL;
+ _tmp1_ = NULL;
+ label = (_tmp2_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_tmp1_ = g_path_get_basename (self->priv->song->filename))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp2_);
+ _tmp1_ = (g_free (_tmp1_), NULL);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, FALSE, FALSE, (guint) 6);
- _tmp3 = NULL;
- hbox = (_tmp3 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp3);
- _tmp4 = NULL;
- label = (_tmp4 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Artist"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp4);
+ _tmp3_ = NULL;
+ hbox = (_tmp3_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp3_);
+ _tmp4_ = NULL;
+ label = (_tmp4_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Artist"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp4_);
gtk_label_set_attributes (label, attrs);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
- _tmp5 = NULL;
- label = (_tmp5 = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->artist)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp5);
+ _tmp5_ = NULL;
+ label = (_tmp5_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->artist)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp5_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, FALSE, FALSE, (guint) 6);
- _tmp6 = NULL;
- hbox = (_tmp6 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp6);
- _tmp7 = NULL;
- label = (_tmp7 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Title"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp7);
+ _tmp6_ = NULL;
+ hbox = (_tmp6_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp6_);
+ _tmp7_ = NULL;
+ label = (_tmp7_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Title"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp7_);
gtk_label_set_attributes (label, attrs);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
- _tmp8 = NULL;
- label = (_tmp8 = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->title)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp8);
+ _tmp8_ = NULL;
+ label = (_tmp8_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->title)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp8_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, FALSE, FALSE, (guint) 6);
- _tmp9 = NULL;
- hbox = (_tmp9 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp9);
- _tmp10 = NULL;
- label = (_tmp10 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Album"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp10);
+ _tmp9_ = NULL;
+ hbox = (_tmp9_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp9_);
+ _tmp10_ = NULL;
+ label = (_tmp10_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Album"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp10_);
gtk_label_set_attributes (label, attrs);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
- _tmp11 = NULL;
- label = (_tmp11 = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->album)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp11);
+ _tmp11_ = NULL;
+ label = (_tmp11_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->album)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp11_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, FALSE, FALSE, (guint) 6);
- _tmp12 = NULL;
- hbox = (_tmp12 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp12);
- _tmp13 = NULL;
- label = (_tmp13 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Date"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp13);
+ _tmp12_ = NULL;
+ hbox = (_tmp12_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp12_);
+ _tmp13_ = NULL;
+ label = (_tmp13_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Date"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp13_);
gtk_label_set_attributes (label, attrs);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
- _tmp14 = NULL;
- label = (_tmp14 = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->date)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp14);
+ _tmp14_ = NULL;
+ label = (_tmp14_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->date)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp14_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
- _tmp15 = NULL;
- label = (_tmp15 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Track"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp15);
+ _tmp15_ = NULL;
+ label = (_tmp15_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Track"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp15_);
gtk_label_set_attributes (label, attrs);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 15);
- _tmp16 = NULL;
- label = (_tmp16 = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->track)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp16);
+ _tmp16_ = NULL;
+ label = (_tmp16_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->track)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp16_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, FALSE, FALSE, (guint) 6);
- _tmp17 = NULL;
- hbox = (_tmp17 = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp17);
- _tmp18 = NULL;
- label = (_tmp18 = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Genre"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp18);
+ _tmp17_ = NULL;
+ hbox = (_tmp17_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), (hbox == NULL) ? NULL : (hbox = (g_object_unref (hbox), NULL)), _tmp17_);
+ _tmp18_ = NULL;
+ label = (_tmp18_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("Genre"))), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp18_);
gtk_label_set_attributes (label, attrs);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
- _tmp19 = NULL;
- label = (_tmp19 = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->genre)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp19);
+ _tmp19_ = NULL;
+ label = (_tmp19_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (self->priv->song->genre)), (label == NULL) ? NULL : (label = (g_object_unref (label), NULL)), _tmp19_);
gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) label, FALSE, FALSE, (guint) 5);
gtk_box_pack_start ((GtkBox*) vbox2, (GtkWidget*) hbox, FALSE, FALSE, (guint) 6);
gtk_box_pack_start ((GtkBox*) ((GtkDialog*) self)->vbox, frame, TRUE, TRUE, (guint) 0);
Modified: xfmpc/trunk/src/statusbar.c
===================================================================
--- xfmpc/trunk/src/statusbar.c 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/statusbar.c 2009-05-02 23:06:23 UTC (rev 7309)
@@ -64,6 +64,7 @@
static GObject * xfmpc_statusbar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static gpointer xfmpc_statusbar_parent_class = NULL;
static void xfmpc_statusbar_finalize (GObject* obj);
+static void xfmpc_statusbar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
@@ -80,12 +81,12 @@
void xfmpc_statusbar_set_text (XfmpcStatusbar* self, const char* value) {
- char* _tmp1;
- const char* _tmp0;
+ char* _tmp1_;
+ const char* _tmp0_;
g_return_if_fail (self != NULL);
- _tmp1 = NULL;
- _tmp0 = NULL;
- self->priv->_text = (_tmp1 = (_tmp0 = value, (_tmp0 == NULL) ? NULL : g_strdup (_tmp0)), self->priv->_text = (g_free (self->priv->_text), NULL), _tmp1);
+ _tmp1_ = NULL;
+ _tmp0_ = NULL;
+ self->priv->_text = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_)), self->priv->_text = (g_free (self->priv->_text), NULL), _tmp1_);
gtk_statusbar_pop ((GtkStatusbar*) self, self->priv->context_id);
gtk_statusbar_push ((GtkStatusbar*) self, self->priv->context_id, self->priv->_text);
g_object_notify ((GObject *) self, "text");
@@ -109,20 +110,6 @@
}
-static void xfmpc_statusbar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
- XfmpcStatusbar * self;
- self = XFMPC_STATUSBAR (object);
- switch (property_id) {
- case XFMPC_STATUSBAR_TEXT:
- xfmpc_statusbar_set_text (self, g_value_get_string (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-
static void xfmpc_statusbar_class_init (XfmpcStatusbarClass * klass) {
xfmpc_statusbar_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (XfmpcStatusbarPrivate));
@@ -156,5 +143,19 @@
}
+static void xfmpc_statusbar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
+ XfmpcStatusbar * self;
+ self = XFMPC_STATUSBAR (object);
+ switch (property_id) {
+ case XFMPC_STATUSBAR_TEXT:
+ xfmpc_statusbar_set_text (self, g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
Modified: xfmpc/trunk/src/xfmpc.h
===================================================================
--- xfmpc/trunk/src/xfmpc.h 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/src/xfmpc.h 2009-05-02 23:06:23 UTC (rev 7309)
@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
+#include <float.h>
+#include <math.h>
G_BEGIN_DECLS
@@ -68,6 +70,28 @@
#define XFMPC_EXTENDED_INTERFACE_TYPE_EXTENDED_INTERFACE_WIDGET (xfmpc_extended_interface_extended_interface_widget_get_type ())
+#define XFMPC_TYPE_INTERFACE (xfmpc_interface_get_type ())
+#define XFMPC_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_INTERFACE, XfmpcInterface))
+#define XFMPC_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_INTERFACE, XfmpcInterfaceClass))
+#define XFMPC_IS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFMPC_TYPE_INTERFACE))
+#define XFMPC_IS_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFMPC_TYPE_INTERFACE))
+#define XFMPC_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFMPC_TYPE_INTERFACE, XfmpcInterfaceClass))
+
+typedef struct _XfmpcInterface XfmpcInterface;
+typedef struct _XfmpcInterfaceClass XfmpcInterfaceClass;
+typedef struct _XfmpcInterfacePrivate XfmpcInterfacePrivate;
+
+#define XFMPC_TYPE_MAIN_WINDOW (xfmpc_main_window_get_type ())
+#define XFMPC_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindow))
+#define XFMPC_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindowClass))
+#define XFMPC_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFMPC_TYPE_MAIN_WINDOW))
+#define XFMPC_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFMPC_TYPE_MAIN_WINDOW))
+#define XFMPC_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFMPC_TYPE_MAIN_WINDOW, XfmpcMainWindowClass))
+
+typedef struct _XfmpcMainWindow XfmpcMainWindow;
+typedef struct _XfmpcMainWindowClass XfmpcMainWindowClass;
+typedef struct _XfmpcMainWindowPrivate XfmpcMainWindowPrivate;
+
#define XFMPC_TYPE_PLAYLIST (xfmpc_playlist_get_type ())
#define XFMPC_PLAYLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFMPC_TYPE_PLAYLIST, XfmpcPlaylist))
#define XFMPC_PLAYLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFMPC_TYPE_PLAYLIST, XfmpcPlaylistClass))
@@ -129,6 +153,24 @@
XFMPC_EXTENDED_INTERFACE_EXTENDED_INTERFACE_WIDGET_DBBROWSER
} XfmpcExtendedInterfaceExtendedInterfaceWidget;
+struct _XfmpcInterface {
+ GtkVBox parent_instance;
+ XfmpcInterfacePrivate * priv;
+};
+
+struct _XfmpcInterfaceClass {
+ GtkVBoxClass parent_class;
+};
+
+struct _XfmpcMainWindow {
+ GtkWindow parent_instance;
+ XfmpcMainWindowPrivate * priv;
+};
+
+struct _XfmpcMainWindowClass {
+ GtkWindowClass parent_class;
+};
+
struct _XfmpcPlaylist {
GtkVBox parent_instance;
XfmpcPlaylistPrivate * priv;
@@ -165,6 +207,20 @@
void xfmpc_extended_interface_set_active (XfmpcExtendedInterface* self, XfmpcExtendedInterfaceExtendedInterfaceWidget active_widget);
XfmpcExtendedInterface* xfmpc_extended_interface_new (void);
XfmpcExtendedInterface* xfmpc_extended_interface_construct (GType object_type);
+GType xfmpc_interface_get_type (void);
+void xfmpc_interface_set_title (XfmpcInterface* self, const char* title);
+void xfmpc_interface_set_subtitle (XfmpcInterface* self, const char* subtitle);
+void xfmpc_interface_pp_clicked (XfmpcInterface* self);
+void xfmpc_interface_set_pp (XfmpcInterface* self, gboolean play);
+void xfmpc_interface_volume_changed (XfmpcInterface* self, double value);
+void xfmpc_interface_set_volume (XfmpcInterface* self, gint volume);
+void xfmpc_interface_popup_volume (XfmpcInterface* self);
+void xfmpc_interface_set_time (XfmpcInterface* self, gint time, gint time_total);
+XfmpcInterface* xfmpc_interface_new (void);
+XfmpcInterface* xfmpc_interface_construct (GType object_type);
+GType xfmpc_main_window_get_type (void);
+XfmpcMainWindow* xfmpc_main_window_new (void);
+XfmpcMainWindow* xfmpc_main_window_construct (GType object_type);
GType xfmpc_playlist_get_type (void);
void xfmpc_playlist_append (XfmpcPlaylist* self, gint id, gint pos, const char* filename, const char* song, const char* length);
void xfmpc_playlist_refresh_current_song (XfmpcPlaylist* self);
Modified: xfmpc/trunk/vapi/config.vapi
===================================================================
--- xfmpc/trunk/vapi/config.vapi 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/vapi/config.vapi 2009-05-02 23:06:23 UTC (rev 7309)
@@ -25,4 +25,8 @@
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/vapi/mpdclient.vapi
===================================================================
--- xfmpc/trunk/vapi/mpdclient.vapi 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/vapi/mpdclient.vapi 2009-05-02 23:06:23 UTC (rev 7309)
@@ -49,9 +49,9 @@
public void update_status ();
public virtual signal void connected ();
public virtual signal void song_changed ();
- public virtual signal void pp_changed ();
- public virtual signal void time_changed ();
- public virtual signal void volume_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 ();
Modified: xfmpc/trunk/vapi/preferences.vapi
===================================================================
--- xfmpc/trunk/vapi/preferences.vapi 2009-05-02 14:06:55 UTC (rev 7308)
+++ xfmpc/trunk/vapi/preferences.vapi 2009-05-02 23:06:23 UTC (rev 7309)
@@ -6,7 +6,7 @@
[CCode (cheader_filename = "preferences.h")]
public class Preferences {
public static unowned Xfmpc.Preferences get ();
- public int last_window_posx;
+ 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; }
More information about the Goodies-commits
mailing list