[gnac/infobar] Infobar branch
- From: David Joaquim <djoaquim src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnac/infobar] Infobar branch
- Date: Mon, 7 Dec 2009 20:38:29 +0000 (UTC)
commit 1064caaf599954c8bf6c90a7bf9625a4abac3794
Author: David Joaquim <djoaquim src gnome org>
Date: Wed Aug 26 15:35:35 2009 +0200
Infobar branch
data/gnac.xml | 114 +++++++++++++++++++++++++++++++++---------------------
src/gnac-main.c | 59 ++++++++++++++++++----------
src/gnac-ui.c | 6 +++
3 files changed, 114 insertions(+), 65 deletions(-)
---
diff --git a/data/gnac.xml b/data/gnac.xml
index a35f999..6afe963 100644
--- a/data/gnac.xml
+++ b/data/gnac.xml
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
-<!--Generated with glade3 3.4.5 on Mon Dec 15 14:23:48 2008 -->
<interface>
+ <!-- interface-requires gtk+ 2.16 -->
+ <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkUIManager" id="uimanager1">
<child>
<object class="GtkActionGroup" id="actiongroup">
@@ -182,14 +183,16 @@
</object>
<object class="GtkMenu" constructor="uimanager1" id="main_popup">
</object>
+
<object class="GtkMenu" constructor="uimanager1" id="tray_popup">
</object>
+
<object class="GtkWindow" id="main_window">
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<property name="default_width">500</property>
<property name="default_height">500</property>
<property name="icon_name">gnac</property>
- <signal handler="gnac_on_ui_destroy_cb" name="delete-event"/>
+ <signal name="delete_event" handler="gnac_on_ui_destroy_cb"/>
<child>
<object class="GtkVBox" id="internal_vbox">
<property name="visible">True</property>
@@ -200,6 +203,7 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -212,25 +216,43 @@
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="main_scrolled_window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <object class="GtkVBox" id="vbox1">
<property name="border_width">5</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkInfoBar" id="info_bar">
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+
+ </child>
<child>
- <object class="GtkTreeView" id="file_list">
+ <object class="GtkScrolledWindow" id="main_scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">False</property>
- <property name="enable_search">False</property>
- <signal handler="gnac_file_list_popup_menu" name="popup_menu"/>
- <signal handler="gnac_file_list_on_button_pressed" name="button_press_event"/>
- <signal handler="gnac_file_list_on_row_activated_cb" name="row_activated"/>
- <signal handler="gnac_on_ui_drag_data_received_cb" name="drag_data_received"/>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="file_list">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="enable_search">False</property>
+ <signal name="button_press_event" handler="gnac_file_list_on_button_pressed"/>
+ <signal name="row_activated" handler="gnac_file_list_on_row_activated_cb"/>
+ <signal name="popup_menu" handler="gnac_file_list_popup_menu"/>
+ <signal name="drag_data_received" handler="gnac_on_ui_drag_data_received_cb"/>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
<packing>
@@ -253,47 +275,51 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property name="spacing">6</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="pause_button">
- <property name="sensitive">False</property>
+ <object class="GtkButton" id="convert_button">
+ <property name="label">gtk-convert</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label">gtk-media-pause</property>
<property name="use_stock">True</property>
- <signal handler="gnac_on_ui_pause_cb" name="clicked"/>
+ <signal name="clicked" handler="gnac_on_ui_convert_cb"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="convert_button">
- <property name="sensitive">False</property>
+ <object class="GtkButton" id="pause_button">
+ <property name="label">gtk-media-pause</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label">gtk-convert</property>
<property name="use_stock">True</property>
- <signal handler="gnac_on_ui_convert_cb" name="clicked"/>
+ <signal name="clicked" handler="gnac_on_ui_pause_cb"/>
</object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
<packing>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -313,17 +339,16 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkStatusbar" id="statusbar">
<property name="visible">True</property>
<property name="spacing">2</property>
- <property name="has_resize_grip">True</property>
</object>
<packing>
- <property name="pack_type">GTK_PACK_END</property>
- <property name="expand">True</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -341,13 +366,15 @@
<property name="border_width">5</property>
<property name="title" translatable="yes">About Gnac</property>
<property name="resizable">False</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="icon_name">gnac</property>
+ <property name="type_hint">dialog</property>
<property name="transient_for">main_window</property>
<property name="has_separator">False</property>
<property name="program_name">Gnac</property>
- <property name="website">http://gnac.sf.net</property>
<property name="copyright">Copyright © 2007-2009 Gnac</property>
+ <property name="comments" translatable="yes">An audio converter for GNOME</property>
+ <property name="website">http://gnac.sf.net</property>
<property name="license" translatable="yes">Gnac 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.
Gnac 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.
@@ -357,15 +384,13 @@ You should have received a copy of the GNU General Public License along with Gna
<property name="authors">Benoit Dupasquier <bdupasqu users sourceforge net>
David Joaquim <daiji users sourceforge net>
Alexandre Roux <alexandreroux users sourceforge net></property>
- <property name="artists">Grada Cristian (krig) <krigenator gmail com></property>
<property name="translator_credits" translatable="yes">translator-credits</property>
- <property name="wrap_license">True</property>
- <property name="icon_name">gnac</property>
+ <property name="artists">Grada Cristian (krig) <krigenator gmail com></property>
<property name="logo_icon_name">gnac</property>
- <property name="comments" translatable="yes">An audio converter for GNOME</property>
- <signal handler="gtk_widget_hide_on_delete" name="close"/>
- <signal handler="gtk_widget_hide_on_delete" name="delete-event"/>
- <signal handler="gtk_widget_hide_on_delete" name="response"/>
+ <property name="wrap_license">True</property>
+ <signal name="close" handler="gtk_widget_hide_on_delete"/>
+ <signal name="response" handler="gtk_widget_hide_on_delete"/>
+ <signal name="delete_event" handler="gtk_widget_hide_on_delete"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
@@ -376,11 +401,12 @@ Alexandre Roux <alexandreroux users sourceforge net></property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
diff --git a/src/gnac-main.c b/src/gnac-main.c
index 9025011..94c3ea8 100644
--- a/src/gnac-main.c
+++ b/src/gnac-main.c
@@ -694,39 +694,56 @@ gnac_on_converter_overwrite_cb(LibgnacConverter *converter,
GFileInfo *info;
GError *error = NULL;
+ g_print("prout\n");
+
uri = (GFile*) file;
info = g_file_query_info(uri, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE, NULL, &error);
+
if (!remember_overwrite)
{
- gint response;
- GtkWidget *dialog;
- GtkWidget *checkbox;
-
- dialog = gtk_message_dialog_new(
- GTK_WINDOW(gnac_ui_get_widget("main_window")),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO,
- _("File %s already exists...\nOverwrite?"),
- g_file_info_get_display_name(info));
+ GtkWidget *vbox;
+ GtkWidget *checkbutton;
+ GtkWidget *info_bar;
+ GtkWidget *content_area;
+ GtkWidget *label;
+ gchar *message;
- gtk_window_set_title(GTK_WINDOW(dialog), APPNAME);
+ info_bar = gnac_ui_get_widget("info_bar");
- checkbox = gtk_check_button_new_with_label(_("Remember my decision"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), FALSE);
- gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->vbox), checkbox, FALSE, FALSE, 0);
- gtk_widget_show(checkbox);
+ message = g_strdup_printf(_("File %s already exists\n Overwrite?"),
+ g_file_info_get_display_name(info));
+ label = gtk_label_new(message);
+ gtk_widget_show(GTK_WIDGET(label));
- gdk_threads_enter();
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gdk_threads_leave();
+ checkbutton = gtk_check_button_new_with_label(_("Remember my decision"));
+ gtk_widget_show(GTK_WIDGET(checkbutton));
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), FALSE);
+ vbox = gtk_vbox_new(FALSE, 6);
+ gtk_widget_show(GTK_WIDGET(vbox));
+
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), checkbutton, FALSE, FALSE, 0);
+
+ content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar));
+ gtk_info_bar_set_message_type(GTK_INFO_BAR(info_bar), GTK_MESSAGE_QUESTION);
+ gtk_info_bar_add_buttons(GTK_INFO_BAR(info_bar), GTK_STOCK_NO, GTK_RESPONSE_NO, GTK_STOCK_YES, GTK_RESPONSE_YES, NULL);
+
+ gtk_container_add (GTK_CONTAINER(content_area), vbox);
+
+
+ g_signal_connect (info_bar, "response",
+ G_CALLBACK (gtk_widget_hide), checkbutton);
+
+ gtk_widget_show(info_bar);
- remember_overwrite = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox));
- gtk_widget_destroy(dialog);
+ // TODO
+ //remember_overwrite = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton));
- overwrite = (response == GTK_RESPONSE_YES);
+ //overwrite = (response == GTK_RESPONSE_YES);
}
g_object_unref(info);
diff --git a/src/gnac-ui.c b/src/gnac-ui.c
index 67fdb57..8c9225f 100644
--- a/src/gnac-ui.c
+++ b/src/gnac-ui.c
@@ -69,6 +69,7 @@ extern GnacState state;
void
gnac_ui_new(void)
{
+ GtkInfoBar *info_bar;
gchar *current_profile;
GtkWidget *file_list;
GtkWidget *audio_profile_hbox;
@@ -117,6 +118,11 @@ gnac_ui_new(void)
audio_profile_edit_button,
FALSE, TRUE, 6);
+
+ info_bar = GTK_INFO_BAR(gtk_builder_get_object(gnac_main_builder, "info_bar"));
+ gtk_widget_set_no_show_all (GTK_WIDGET(info_bar), TRUE);
+ gtk_widget_show(GTK_WIDGET(info_bar));
+
/* DnD portion code */
gtk_drag_dest_set(file_list,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]