[Xfce4-commits] r24537 - in squeeze/trunk: docs/reference/libsqueeze/tmpl libsqueeze src
Stephan Arts
stephan at xfce.org
Fri Jan 19 01:04:21 CET 2007
Author: stephan
Date: 2007-01-19 00:04:21 +0000 (Fri, 19 Jan 2007)
New Revision: 24537
Modified:
squeeze/trunk/docs/reference/libsqueeze/tmpl/archive.sgml
squeeze/trunk/libsqueeze/archive-support-gnu-tar.c
squeeze/trunk/libsqueeze/archive-support.c
squeeze/trunk/libsqueeze/archive-support.h
squeeze/trunk/libsqueeze/archive.c
squeeze/trunk/libsqueeze/archive.h
squeeze/trunk/src/main_window.c
squeeze/trunk/src/properties_dialog.c
Log:
fixed stop button
Modified: squeeze/trunk/docs/reference/libsqueeze/tmpl/archive.sgml
===================================================================
--- squeeze/trunk/docs/reference/libsqueeze/tmpl/archive.sgml 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/docs/reference/libsqueeze/tmpl/archive.sgml 2007-01-19 00:04:21 UTC (rev 24537)
@@ -268,10 +268,10 @@
</para>
- at Param1:
- at Param2:
- at Param3:
- at Param4:
+ at archive:
+ at iter:
+ at n:
+ at value:
@Returns:
@@ -280,9 +280,9 @@
</para>
- at Param1:
- at Param2:
- at Param3:
+ at archive:
+ at iter:
+ at value:
@icon_theme:
@@ -291,8 +291,8 @@
</para>
- at Param1:
- at Param2:
+ at archive:
+ at path:
@Returns:
@@ -301,8 +301,8 @@
</para>
- at Param1:
- at Param2:
+ at archive:
+ at path:
@Returns:
@@ -311,8 +311,8 @@
</para>
- at Param1:
- at Param2:
+ at archive:
+ at n:
@Returns:
@@ -321,8 +321,8 @@
</para>
- at Param1:
- at Param2:
+ at archive:
+ at n:
@Returns:
@@ -331,7 +331,7 @@
</para>
- at Param1:
+ at archive:
@Returns:
Modified: squeeze/trunk/libsqueeze/archive-support-gnu-tar.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support-gnu-tar.c 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/libsqueeze/archive-support-gnu-tar.c 2007-01-19 00:04:21 UTC (rev 24537)
@@ -445,7 +445,7 @@
g_free(archive_path);
return 0;
}
- archive->tmp_file = g_strconcat(lsq_tmp_dir, "/squeeze-XXXXXX" , NULL);
+ archive->tmp_file = g_strconcat(lsq_tmp_dir, "/squeeze-XXXXXX.tar" , NULL);
g_mkstemp(archive->tmp_file);
if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), "application/x-tarz"))
command = g_strconcat("uncompress -c ", archive_path, NULL);
@@ -655,6 +655,7 @@
}
return TRUE;
}
+
gboolean
lsq_archive_support_gnu_tar_decompress_parse_output(GIOChannel *ioc, GIOCondition cond, gpointer data)
{
Modified: squeeze/trunk/libsqueeze/archive-support.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support.c 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/libsqueeze/archive-support.c 2007-01-19 00:04:21 UTC (rev 24537)
@@ -370,3 +370,19 @@
{
action->callback->notify_func(action, message);
}
+
+/**
+ * gboolean
+ * lsq_archive_support_can_stop(LSQArchiveSupport *support)
+ *
+ * Returns: TRUE if there is no risk of corrupting the archive when closing the support-app
+ * FALSE otherwise, there should be a warning dialog to let the user proceed anyway.
+ *
+ */
+gboolean
+lsq_archive_support_can_stop(LSQArchiveSupport *support, LSQArchive *archive)
+{
+ if(lsq_archive_get_status(archive) == LSQ_ARCHIVESTATUS_REFRESH)
+ return TRUE;
+ return FALSE;
+}
Modified: squeeze/trunk/libsqueeze/archive-support.h
===================================================================
--- squeeze/trunk/libsqueeze/archive-support.h 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/libsqueeze/archive-support.h 2007-01-19 00:04:21 UTC (rev 24537)
@@ -106,7 +106,7 @@
gboolean lsq_archive_support_mime_supported(LSQArchiveSupport *,const gchar *mime);
GSList * lsq_get_registered_support_list();
-gboolean lsq_register_support(LSQArchiveSupport *);
+gboolean lsq_register_support(LSQArchiveSupport *support);
LSQArchiveSupport * lsq_get_support_for_mime(ThunarVfsMimeInfo *mime_info);
LSQArchiveSupport * lsq_get_support_for_mime_from_slist(GSList *list, const gchar *mime);
@@ -120,12 +120,14 @@
gint lsq_archive_support_refresh(LSQArchiveSupport *, LSQArchive *);
guint64 lsq_archive_support_get_max_n_files(LSQArchiveSupport *);
-GSList * lsq_archive_support_list_properties(LSQArchiveSupport *, gchar *);
+gboolean lsq_archive_support_can_stop(LSQArchiveSupport *support, LSQArchive *archive);
-void lsq_archive_support_install_action(LSQArchiveSupport *, LSQCustomAction *);
-LSQCustomAction* lsq_archive_support_find_action(LSQArchiveSupport *, const gchar *name);
-LSQCustomAction** lsq_archive_support_list_actions(LSQArchiveSupport *, guint *n_actions);
+GSList * lsq_archive_support_list_properties(LSQArchiveSupport *support, gchar *);
+void lsq_archive_support_install_action(LSQArchiveSupport *support, LSQCustomAction *action);
+LSQCustomAction* lsq_archive_support_find_action(LSQArchiveSupport *support, const gchar *name);
+LSQCustomAction** lsq_archive_support_list_actions(LSQArchiveSupport *support, guint *n_actions);
+
LSQCustomAction* lsq_custom_action_new(const gchar *name,
const gchar *nick,
const gchar *blurb,
@@ -133,12 +135,12 @@
LSQCustomActionFunc func,
LSQArchiveSupport *support,
gpointer user_data);
-const gchar* lsq_custom_action_get_name(LSQCustomAction*);
-const gchar* lsq_custom_action_get_nick(LSQCustomAction*);
-const gchar* lsq_custom_action_get_blurb(LSQCustomAction*);
-const gchar* lsq_custom_action_get_icon_name(LSQCustomAction*);
-void lsq_custom_action_execute(LSQCustomAction*, LSQArchive *, LSQCustomActionCallback *);
-void lsq_custom_action_notify(LSQCustomAction*, const gchar*);
+const gchar* lsq_custom_action_get_name(LSQCustomAction *action);
+const gchar* lsq_custom_action_get_nick(LSQCustomAction *action);
+const gchar* lsq_custom_action_get_blurb(LSQCustomAction *action);
+const gchar* lsq_custom_action_get_icon_name(LSQCustomAction *action);
+void lsq_custom_action_execute(LSQCustomAction *action, LSQArchive *archive, LSQCustomActionCallback *callback);
+void lsq_custom_action_notify(LSQCustomAction *action, const gchar *);
G_END_DECLS
Modified: squeeze/trunk/libsqueeze/archive.c
===================================================================
--- squeeze/trunk/libsqueeze/archive.c 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/libsqueeze/archive.c 2007-01-19 00:04:21 UTC (rev 24537)
@@ -1583,3 +1583,11 @@
iter = g_slist_next(iter);
}
}
+
+gboolean
+lsq_archive_stop(LSQArchive *archive)
+{
+ if(archive->child_pid)
+ kill ( archive->child_pid , SIGHUP);
+ return TRUE;
+}
Modified: squeeze/trunk/libsqueeze/archive.h
===================================================================
--- squeeze/trunk/libsqueeze/archive.h 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/libsqueeze/archive.h 2007-01-19 00:04:21 UTC (rev 24537)
@@ -131,21 +131,23 @@
void lsq_archive_iter_set_props(LSQArchive *, LSQArchiveIter *, ...) G_GNUC_INTERNAL;
void lsq_archive_iter_set_propsv(LSQArchive *, LSQArchiveIter *, gconstpointer *) G_GNUC_INTERNAL;
-gboolean lsq_archive_iter_get_prop_value(const LSQArchive *, const LSQArchiveIter *, guint, GValue *);
-void lsq_archive_iter_get_icon_name(const LSQArchive *, const LSQArchiveIter *, GValue *, GtkIconTheme *icon_theme);
+gboolean lsq_archive_iter_get_prop_value(const LSQArchive *archive, const LSQArchiveIter *iter, guint n, GValue *value);
+void lsq_archive_iter_get_icon_name(const LSQArchive *archive, const LSQArchiveIter *iter, GValue *value, GtkIconTheme *icon_theme);
-LSQArchiveIter *lsq_archive_add_file(LSQArchive *, const gchar *) G_GNUC_INTERNAL;
-gboolean lsq_archive_del_file(LSQArchive *, const gchar *);
-LSQArchiveIter *lsq_archive_get_iter(const LSQArchive *, const gchar *);
-GType lsq_archive_get_entry_property_type(LSQArchive *, guint);
-const gchar *lsq_archive_get_entry_property_name(LSQArchive *, guint);
-void lsq_archive_clear_entry_property_types(LSQArchive *) G_GNUC_INTERNAL;
-void lsq_archive_set_entry_property_type(LSQArchive *, guint, GType, const gchar *) G_GNUC_INTERNAL;
-void lsq_archive_set_entry_property_typesv(LSQArchive *, GType *, const gchar **) G_GNUC_INTERNAL;
-guint lsq_archive_n_property(LSQArchive *);
-guint64 lsq_archive_get_n_files(LSQArchive *);
-guint64 lsq_archive_get_n_directories(LSQArchive *);
+LSQArchiveIter *lsq_archive_add_file(LSQArchive *archive, const gchar *path) G_GNUC_INTERNAL;
+gboolean lsq_archive_del_file(LSQArchive *archive, const gchar *path);
+LSQArchiveIter *lsq_archive_get_iter(const LSQArchive *archive, const gchar *path);
+GType lsq_archive_get_entry_property_type(LSQArchive *archive, guint n);
+const gchar *lsq_archive_get_entry_property_name(LSQArchive *archive, guint n);
+void lsq_archive_clear_entry_property_types(LSQArchive *archive) G_GNUC_INTERNAL;
+void lsq_archive_set_entry_property_type(LSQArchive *archive , guint n, GType type, const gchar *name) G_GNUC_INTERNAL;
+void lsq_archive_set_entry_property_typesv(LSQArchive *archive, GType *types, const gchar **names) G_GNUC_INTERNAL;
+guint lsq_archive_n_property(LSQArchive *archive);
+guint64 lsq_archive_get_n_files(LSQArchive *archive);
+guint64 lsq_archive_get_n_directories(LSQArchive *archive);
+gboolean lsq_archive_stop(LSQArchive *archive);
+
void lsq_archive_add_children(LSQArchive *, GSList *) G_GNUC_INTERNAL;
G_END_DECLS
Modified: squeeze/trunk/src/main_window.c
===================================================================
--- squeeze/trunk/src/main_window.c 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/src/main_window.c 2007-01-19 00:04:21 UTC (rev 24537)
@@ -771,7 +771,7 @@
if(filenames)
{
- dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Are you sure you want to remove the selected files?");
+ dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("Are you sure you want to remove the selected files?"));
result = gtk_dialog_run(GTK_DIALOG(dialog));
if(result == GTK_RESPONSE_YES)
{
@@ -800,7 +800,28 @@
static void
cb_sq_main_stop_archive(GtkWidget *widget, gpointer userdata)
{
+ SQMainWindow *window = SQ_MAIN_WINDOW(userdata);
+ LSQArchive *lp_archive = NULL;
+ LSQArchiveSupport *lp_support = NULL;
+ GtkWidget *dialog = NULL;
+ gint result = 0;
+ sq_notebook_get_active_archive(SQ_NOTEBOOK(window->notebook), &lp_archive, &lp_support);
+
+ if(lsq_archive_support_can_stop(lp_support, lp_archive))
+ lsq_archive_stop(lp_archive);
+ else
+ {
+ dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+ _("Are you sure you want to cancel this operation?\nThis could damage the archive."));
+ result = gtk_dialog_run(GTK_DIALOG(dialog));
+ if(result == GTK_RESPONSE_YES)
+ {
+ gtk_widget_hide(dialog);
+ lsq_archive_stop(lp_archive);
+ }
+ gtk_widget_destroy(dialog);
+ }
}
static void
@@ -906,8 +927,12 @@
LSQArchiveSupport *lp_support;
sq_notebook_page_get_archive(notebook, &lp_archive, &lp_support, page_nr);
SQMainWindow *window = SQ_MAIN_WINDOW(data);
+ LSQArchiveStatus status = LSQ_ARCHIVESTATUS_IDLE;
- if(lp_archive || lsq_archive_get_status(lp_archive) == LSQ_ARCHIVESTATUS_IDLE)
+ if(lp_archive)
+ status = lsq_archive_get_status(lp_archive);
+
+ if(lp_archive && (status == LSQ_ARCHIVESTATUS_IDLE || status == LSQ_ARCHIVESTATUS_ERROR || status == LSQ_ARCHIVESTATUS_USERBREAK))
{
gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_add), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_extract), TRUE);
@@ -1085,6 +1110,23 @@
{
SQMainWindow *window = SQ_MAIN_WINDOW(userdata);
+ LSQArchiveStatus status = lsq_archive_get_status(archive);
+
+ if((status == LSQ_ARCHIVESTATUS_IDLE) || (status == LSQ_ARCHIVESTATUS_USERBREAK) || (status == LSQ_ARCHIVESTATUS_ERROR))
+ {
+ gtk_widget_set_sensitive(window->menubar.menu_item_close, TRUE);
+ gtk_widget_set_sensitive(window->menubar.menu_item_properties, TRUE);
+
+ gtk_widget_set_sensitive(window->menubar.menu_item_add, TRUE);
+ gtk_widget_set_sensitive(window->menubar.menu_item_extract, TRUE);
+ gtk_widget_set_sensitive(window->menubar.menu_item_remove, TRUE);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_extract), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_remove), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_stop), FALSE);
+ }
+
guint context_id = gtk_statusbar_get_context_id(GTK_STATUSBAR(window->statusbar), "Window Statusbar");
gtk_statusbar_push(GTK_STATUSBAR(window->statusbar), context_id, lsq_archive_get_status_msg(archive));
}
Modified: squeeze/trunk/src/properties_dialog.c
===================================================================
--- squeeze/trunk/src/properties_dialog.c 2007-01-18 23:10:27 UTC (rev 24536)
+++ squeeze/trunk/src/properties_dialog.c 2007-01-19 00:04:21 UTC (rev 24537)
@@ -77,7 +77,7 @@
gtk_widget_show (GTK_WIDGET(dialog->table));
box = gtk_hbox_new(6, FALSE);
- gtk_table_attach (dialog->table, box, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 3);
+ gtk_table_attach (dialog->table, box, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3);
gtk_widget_show (box);
dialog->icon_image = gtk_image_new();
@@ -92,7 +92,7 @@
gtk_table_attach (dialog->table, dialog->filename_label, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 3);
gtk_widget_show(dialog->filename_label);
- dialog->prop_table = (GtkTable *)gtk_table_new(2, 1, FALSE);
+ dialog->prop_table = (GtkTable *)gtk_table_new(2, 1, TRUE);
gtk_table_set_col_spacings (dialog->prop_table, 12);
gtk_table_attach (dialog->table, GTK_WIDGET(dialog->prop_table), 0, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 3);
gtk_widget_show(GTK_WIDGET(dialog->prop_table));
@@ -121,7 +121,8 @@
"title", _("Properties"),
NULL);
- gtk_widget_set_size_request(GTK_WIDGET(dialog), 220, 200);
+ gtk_widget_set_size_request(dialog, 220, 400);
+ gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
GdkPixbuf *icon = gtk_icon_theme_load_icon(icon_theme, thunar_vfs_mime_info_lookup_icon_name(archive->mime_info, icon_theme), 48, 0, NULL);
gtk_image_set_from_pixbuf(GTK_IMAGE(((SQPropertiesDialog *)dialog)->icon_image), icon);
More information about the Xfce4-commits
mailing list