Remove 'filename' argument from sokoke_spawn_program

This commit is contained in:
Christian Dywan 2010-10-10 13:27:06 +02:00
parent 120c5bf40f
commit e74f89f8c2
5 changed files with 15 additions and 16 deletions

View file

@ -291,22 +291,23 @@ midori_addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
MidoriWebSettings* settings; MidoriWebSettings* settings;
MidoriBrowser* browser; MidoriBrowser* browser;
gchar* text_editor; gchar* text_editor;
gchar* element_uri;
browser = midori_browser_get_for_widget (GTK_WIDGET (addons->treeview)); browser = midori_browser_get_for_widget (GTK_WIDGET (addons->treeview));
settings = katze_object_get_object (browser, "settings"); settings = katze_object_get_object (browser, "settings");
gtk_tree_model_get (model, &iter, 0, &element, -1); gtk_tree_model_get (model, &iter, 0, &element, -1);
element_uri = g_filename_to_uri (element->fullpath, NULL, NULL);
g_object_get (settings, "text-editor", &text_editor, NULL); g_object_get (settings, "text-editor", &text_editor, NULL);
if (text_editor && *text_editor) if (text_editor && *text_editor)
sokoke_spawn_program (text_editor, element_uri, TRUE); sokoke_spawn_program (text_editor, element->fullpath);
else else
{
gchar* element_uri = g_filename_to_uri (element->fullpath, NULL, NULL);
sokoke_show_uri (NULL, element_uri, sokoke_show_uri (NULL, element_uri,
gtk_get_current_event_time (), NULL); gtk_get_current_event_time (), NULL);
g_free (element_uri);
}
g_free (element_uri);
g_free (text_editor); g_free (text_editor);
} }
} }

View file

@ -2228,7 +2228,7 @@ midori_browser_subscribe_to_news_feed (MidoriBrowser* browser,
const gchar* uri) const gchar* uri)
{ {
if (browser->news_aggregator && *browser->news_aggregator) if (browser->news_aggregator && *browser->news_aggregator)
sokoke_spawn_program (browser->news_aggregator, uri, FALSE); sokoke_spawn_program (browser->news_aggregator, uri);
else else
{ {
gchar* description = g_strdup_printf ("%s\n\n%s", uri, gchar* description = g_strdup_printf ("%s\n\n%s", uri,
@ -3262,7 +3262,7 @@ midori_browser_source_transfer_cb (KatzeNetRequest* request,
g_object_get (browser->settings, g_object_get (browser->settings,
"text-editor", &text_editor, NULL); "text-editor", &text_editor, NULL);
if (text_editor && *text_editor) if (text_editor && *text_editor)
sokoke_spawn_program (text_editor, unique_filename, TRUE); sokoke_spawn_program (text_editor, unique_filename);
else else
sokoke_show_uri (NULL, unique_filename, sokoke_show_uri (NULL, unique_filename,
gtk_get_current_event_time (), NULL); gtk_get_current_event_time (), NULL);
@ -3326,7 +3326,7 @@ _action_source_view_activate (GtkAction* action,
if (g_str_has_prefix (uri, "file://")) if (g_str_has_prefix (uri, "file://"))
{ {
gchar* filename = g_filename_from_uri (uri, NULL, NULL); gchar* filename = g_filename_from_uri (uri, NULL, NULL);
sokoke_spawn_program (text_editor, filename, TRUE); sokoke_spawn_program (text_editor, filename);
g_free (filename); g_free (filename);
return; return;
} }

View file

@ -1791,7 +1791,7 @@ midori_web_view_menu_video_download_activate_cb (GtkWidget* widget,
MidoriView* view) MidoriView* view)
{ {
gchar* uri = katze_object_get_string (view->hit_test, "media-uri"); gchar* uri = katze_object_get_string (view->hit_test, "media-uri");
sokoke_spawn_program (view->download_manager, uri, FALSE); sokoke_spawn_program (view->download_manager, uri);
g_free (uri); g_free (uri);
} }
#endif #endif
@ -1878,7 +1878,7 @@ static void
midori_web_view_menu_download_activate_cb (GtkWidget* widget, midori_web_view_menu_download_activate_cb (GtkWidget* widget,
MidoriView* view) MidoriView* view)
{ {
sokoke_spawn_program (view->download_manager, view->link_uri, FALSE); sokoke_spawn_program (view->download_manager, view->link_uri);
} }
static void static void

View file

@ -375,15 +375,14 @@ sokoke_show_uri (GdkScreen* screen,
gboolean gboolean
sokoke_spawn_program (const gchar* command, sokoke_spawn_program (const gchar* command,
const gchar* argument, const gchar* argument)
gboolean filename)
{ {
GError* error; GError* error;
g_return_val_if_fail (command != NULL, FALSE); g_return_val_if_fail (command != NULL, FALSE);
g_return_val_if_fail (argument != NULL, FALSE); g_return_val_if_fail (argument != NULL, FALSE);
if (filename) if (!g_strstr_len (argument, 8, "://"))
{ {
gboolean success; gboolean success;
@ -494,7 +493,7 @@ sokoke_spawn_app (const gchar* uri)
gchar* quoted = g_shell_quote (executable); gchar* quoted = g_shell_quote (executable);
gchar* command = g_strconcat (quoted, " -a", NULL); gchar* command = g_strconcat (quoted, " -a", NULL);
g_free (quoted); g_free (quoted);
sokoke_spawn_program (command, uri, FALSE); sokoke_spawn_program (command, uri);
g_free (command); g_free (command);
} }

View file

@ -98,9 +98,8 @@ sokoke_show_uri (GdkScreen* screen,
GError** error); GError** error);
gboolean gboolean
sokoke_spawn_program (const gchar* command, sokoke_spawn_program (const gchar* command,
const gchar* argument, const gchar* argument);
gboolean quote);
void void
sokoke_spawn_app (const gchar* uri); sokoke_spawn_app (const gchar* uri);