[file-roller] update the commands capabilities after installing a package
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [file-roller] update the commands capabilities after installing a package
- Date: Sun, 25 Oct 2009 08:14:41 +0000 (UTC)
commit fc2438093862dc89c1ca4c556d247efcc0492f19
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Oct 25 09:13:38 2009 +0100
update the commands capabilities after installing a package
src/dlg-package-installer.c | 2 ++
src/main.c | 24 ++++++++++++++++++++++++
src/main.h | 19 ++++++++++---------
3 files changed, 36 insertions(+), 9 deletions(-)
---
diff --git a/src/dlg-package-installer.c b/src/dlg-package-installer.c
index a5e4181..42618dd 100644
--- a/src/dlg-package-installer.c
+++ b/src/dlg-package-installer.c
@@ -27,6 +27,7 @@
#include <gtk/gtk.h>
#include <dbus/dbus-glib.h>
#include "dlg-package-installer.h"
+#include "main.h"
typedef struct {
@@ -57,6 +58,7 @@ package_installer_terminated (InstallerData *idata,
error);
}
else {
+ update_registered_commands_capabilities ();
if (fr_window_is_batch_mode (idata->window))
fr_window_resume_batch (idata->window);
else
diff --git a/src/main.c b/src/main.c
index 63c4288..b013ed5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -663,6 +663,30 @@ get_preferred_command_for_mime_type (const char *mime_type,
}
+void
+update_registered_commands_capabilities (void)
+{
+ int i;
+
+ for (i = 0; i < Registered_Commands->len; i++) {
+ FrRegisteredCommand *reg_com;
+ FrCommand *command;
+ int j;
+
+ reg_com = g_ptr_array_index (Registered_Commands, i);
+ command = (FrCommand*) g_object_new (reg_com->type, NULL);
+ for (j = 0; j < reg_com->caps->len; j++) {
+ FrMimeTypeCap *cap = g_ptr_array_index (reg_com->caps, j);
+
+ cap->current_capabilities = fr_command_get_capabilities (command, cap->mime_type, TRUE);
+ cap->potential_capabilities = fr_command_get_capabilities (command, cap->mime_type, FALSE);
+ }
+
+ g_object_unref (command);
+ }
+}
+
+
const char *
get_mime_type_from_extension (const char *ext)
{
diff --git a/src/main.h b/src/main.h
index 8d500f0..fa88514 100644
--- a/src/main.h
+++ b/src/main.h
@@ -70,14 +70,15 @@ extern int save_type[]; /* File types that can be saved. */
extern int open_type[]; /* File types that can be opened. */
extern int create_type[]; /* File types that can be created. */
-GType get_command_type_from_mime_type (const char *mime_type,
- FrCommandCaps requested_capabilities);
-GType get_preferred_command_for_mime_type (const char *mime_type,
- FrCommandCaps requested_capabilities);
-const char * get_mime_type_from_extension (const char *ext);
-const char * get_archive_filename_extension (const char *uri);
-int get_mime_type_index (const char *mime_type);
-void sort_mime_types_by_extension (int *a);
-void sort_mime_types_by_description (int *a);
+GType get_command_type_from_mime_type (const char *mime_type,
+ FrCommandCaps requested_capabilities);
+GType get_preferred_command_for_mime_type (const char *mime_type,
+ FrCommandCaps requested_capabilities);
+void update_registered_commands_capabilities (void);
+const char * get_mime_type_from_extension (const char *ext);
+const char * get_archive_filename_extension (const char *uri);
+int get_mime_type_index (const char *mime_type);
+void sort_mime_types_by_extension (int *a);
+void sort_mime_types_by_description (int *a);
#endif /* MAIN_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]