[Xfce4-commits] <xfce-utils:master> Remove run argument feature.
Jérôme Guelfucci
noreply at xfce.org
Mon Oct 25 20:28:01 CEST 2010
Updating branch refs/heads/master
to 32fe44d397572654258108291d784b200d6daeb0 (commit)
from a4156b9c6e8ee82385037d4844a1a79e21c63d21 (commit)
commit 32fe44d397572654258108291d784b200d6daeb0
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Mon Oct 25 18:52:15 2010 +0200
Remove run argument feature.
xfrun/xfrun-dbus.c | 28 +++++-----------------
xfrun/xfrun-dialog.c | 60 +------------------------------------------------
xfrun/xfrun-dialog.h | 4 +--
xfrun/xfrun.c | 6 +---
4 files changed, 12 insertions(+), 86 deletions(-)
diff --git a/xfrun/xfrun-dbus.c b/xfrun/xfrun-dbus.c
index cef2650..2aa751c 100644
--- a/xfrun/xfrun-dbus.c
+++ b/xfrun/xfrun-dbus.c
@@ -55,7 +55,6 @@
* method: org.xfce.RunDialog.OpenDialog
* param: display_name (DBUS_TYPE_STRING)
* param: working_directory (DBUS_TYPE_STRING)
- * param: run_argument (DBUS_TYPE_STRING)
* return: success, or org.xfce.RunDialog.ErrorGeneral
* description: shows the run dialog on the specified display. will execute
* the command in the specified working directory. an optional
@@ -123,14 +122,13 @@ xfrun_handle_dbus_message(DBusConnection *connection,
{
DBusMessage *reply = NULL;
DBusError derror;
- gchar *display_name = NULL, *cwd = NULL, *run_argument = NULL;
+ gchar *display_name = NULL, *cwd = NULL;
dbus_error_init(&derror);
if(!dbus_message_get_args(message, &derror,
DBUS_TYPE_STRING, &display_name,
DBUS_TYPE_STRING, &cwd,
- DBUS_TYPE_STRING, &run_argument,
DBUS_TYPE_INVALID))
{
reply = dbus_message_new_error(message, RUNDIALOG_DBUS_ERROR_GENERAL,
@@ -150,19 +148,14 @@ xfrun_handle_dbus_message(DBusConnection *connection,
} else {
GtkWidget *dialog;
- if(!strlen(run_argument))
- run_argument = NULL;
-
if(static_dialog_in_use) {
- dialog = xfrun_dialog_new(run_argument);
+ dialog = xfrun_dialog_new();
xfrun_dialog_set_destroy_on_close(XFRUN_DIALOG(dialog),
TRUE);
xfrun_dialog_set_working_directory(XFRUN_DIALOG(dialog),
cwd);
} else {
dialog = static_dialog;
- xfrun_dialog_set_run_argument(XFRUN_DIALOG(dialog),
- run_argument);
xfrun_dialog_set_working_directory(XFRUN_DIALOG(dialog),
cwd);
if(GTK_WIDGET_REALIZED(dialog)) {
@@ -243,13 +236,13 @@ xfrun_register_dbus_service(void)
/* client handler */
static gboolean
-xfrun_show_dialog(const gchar *run_argument)
+xfrun_show_dialog(void)
{
DBusConnection *connection;
DBusMessage *method;
DBusMessage *result;
DBusError derror;
- gchar *cwd, *display_name, *dummy_run_argument = NULL;
+ gchar *cwd, *display_name;
dbus_error_init(&derror);
connection = dbus_bus_get(DBUS_BUS_SESSION, &derror);
@@ -267,18 +260,13 @@ xfrun_show_dialog(const gchar *run_argument)
display_name = gdk_screen_make_display_name(gdk_screen_get_default());
cwd = g_get_current_dir();
- if(!run_argument)
- run_argument = dummy_run_argument = g_strdup("");
-
dbus_message_append_args(method,
DBUS_TYPE_STRING, &display_name,
DBUS_TYPE_STRING, &cwd,
- DBUS_TYPE_STRING, &run_argument,
DBUS_TYPE_INVALID);
g_free(display_name);
g_free(cwd);
- g_free(dummy_run_argument);
result = dbus_connection_send_with_reply_and_block(connection, method,
5000, &derror);
@@ -369,7 +357,7 @@ main(int argc,
#endif
}
- static_dialog = xfrun_dialog_new(NULL);
+ static_dialog = xfrun_dialog_new();
xfrun_dialog_set_destroy_on_close(XFRUN_DIALOG(static_dialog), FALSE);
g_signal_connect(G_OBJECT(static_dialog), "closed",
G_CALLBACK(xfrun_static_dialog_closed), NULL);
@@ -384,10 +372,8 @@ main(int argc,
return 1;
}
- if(!xfrun_show_dialog(argc > 1 ? argv[1] : NULL)) {
- GtkWidget *fallback_dialog = xfrun_dialog_new(argc > 1
- ? argv[1]
- : NULL);
+ if(!xfrun_show_dialog()) {
+ GtkWidget *fallback_dialog = xfrun_dialog_new();
xfrun_dialog_set_destroy_on_close(XFRUN_DIALOG(fallback_dialog),
TRUE);
g_signal_connect(G_OBJECT(fallback_dialog), "destroy",
diff --git a/xfrun/xfrun-dialog.c b/xfrun/xfrun-dialog.c
index ff25a26..cbd6b62 100644
--- a/xfrun/xfrun-dialog.c
+++ b/xfrun/xfrun-dialog.c
@@ -51,7 +51,6 @@ struct _XfrunDialogPrivate
GtkWidget *terminal_chk;
GtkTreeModel *completion_model;
- gchar *run_argument;
gboolean destroy_on_close;
gchar *working_directory;
@@ -61,7 +60,6 @@ struct _XfrunDialogPrivate
enum
{
PROP0,
- PROP_RUN_ARGUMENT,
PROP_WORKING_DIRECTORY,
};
@@ -141,13 +139,6 @@ xfrun_dialog_class_init(XfrunDialogClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- g_object_class_install_property(gobject_class, PROP_RUN_ARGUMENT,
- g_param_spec_string("run-argument",
- "Run argument",
- "1st argument to pass to the program run",
- NULL,
- G_PARAM_READWRITE));
-
g_object_class_install_property(gobject_class, PROP_WORKING_DIRECTORY,
g_param_spec_string("working-directory",
"Working directory",
@@ -228,10 +219,6 @@ xfrun_dialog_set_property(GObject *object,
XfrunDialog *dialog = XFRUN_DIALOG(object);
switch(property_id) {
- case PROP_RUN_ARGUMENT:
- xfrun_dialog_set_run_argument(dialog, g_value_get_string(value));
- break;
-
case PROP_WORKING_DIRECTORY:
xfrun_dialog_set_working_directory(dialog,
g_value_get_string(value));
@@ -252,10 +239,6 @@ xfrun_dialog_get_property(GObject *object,
XfrunDialog *dialog = XFRUN_DIALOG(object);
switch(property_id) {
- case PROP_RUN_ARGUMENT:
- g_value_set_string(value, xfrun_dialog_get_run_argument(dialog));
- break;
-
case PROP_WORKING_DIRECTORY:
g_value_set_string(value,
xfrun_dialog_get_working_directory(dialog));
@@ -272,7 +255,6 @@ xfrun_dialog_finalize(GObject *object)
{
XfrunDialog *dialog = XFRUN_DIALOG(object);
- g_free(dialog->priv->run_argument);
g_free(dialog->priv->working_directory);
g_free(dialog->priv->entry_val_tmp);
@@ -517,17 +499,6 @@ xfrun_run_clicked(GtkWidget *widget,
gscreen = gtk_widget_get_screen(widget);
- if(dialog->priv->run_argument) {
- gchar *run_arg_quoted;
-
- run_arg_quoted = g_shell_quote(dialog->priv->run_argument);
- new_cmdline = g_strconcat(cmdline, " ", run_arg_quoted, NULL);
-
- g_free(run_arg_quoted);
- g_free(cmdline);
- cmdline = new_cmdline;
- }
-
if(g_str_has_prefix(cmdline, "#"))
{
/* Shortcut to open manpages in terminal */
@@ -682,36 +653,9 @@ xfrun_create_completion_model(XfrunDialog *dialog)
GtkWidget *
-xfrun_dialog_new(const gchar *run_argument)
+xfrun_dialog_new(void)
{
- return g_object_new(XFRUN_TYPE_DIALOG,
- "run-argument", run_argument,
- NULL);
-}
-
-void
-xfrun_dialog_set_run_argument(XfrunDialog *dialog,
- const gchar *run_argument)
-{
- g_return_if_fail(XFRUN_IS_DIALOG(dialog));
-
- g_free(dialog->priv->run_argument);
- dialog->priv->run_argument = g_strdup(run_argument);
-
- if(run_argument) {
- gchar *title = g_strdup_printf(_("Open %s with what program?"),
- run_argument);
- gtk_window_set_title(GTK_WINDOW(dialog), title);
- g_free(title);
- } else
- gtk_window_set_title(GTK_WINDOW(dialog), _("Run program"));
-}
-
-G_CONST_RETURN gchar *
-xfrun_dialog_get_run_argument(XfrunDialog *dialog)
-{
- g_return_val_if_fail(XFRUN_IS_DIALOG(dialog), NULL);
- return dialog->priv->run_argument;
+ return g_object_new(XFRUN_TYPE_DIALOG, NULL);
}
void
diff --git a/xfrun/xfrun-dialog.h b/xfrun/xfrun-dialog.h
index c5c6e49..ff5d6f0 100644
--- a/xfrun/xfrun-dialog.h
+++ b/xfrun/xfrun-dialog.h
@@ -51,10 +51,8 @@ struct _XfrunDialogClass
GType xfrun_dialog_get_type (void) G_GNUC_CONST;
-GtkWidget *xfrun_dialog_new (const gchar *run_argument);
+GtkWidget *xfrun_dialog_new (void);
-void xfrun_dialog_set_run_argument (XfrunDialog *dialog,
- const gchar *run_argument);
G_CONST_RETURN gchar *xfrun_dialog_get_run_argument(XfrunDialog *dialog);
void xfrun_dialog_set_destroy_on_close (XfrunDialog *dialog,
diff --git a/xfrun/xfrun.c b/xfrun/xfrun.c
index bac292a..c90a7d6 100644
--- a/xfrun/xfrun.c
+++ b/xfrun/xfrun.c
@@ -37,7 +37,6 @@ main(int argc,
char **argv)
{
GtkWidget *dialog;
- const gchar *run_argument = NULL;
xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
@@ -52,11 +51,10 @@ main(int argc,
_("Xfrun must be compiled with D-BUS support to enable daemon mode."),
GTK_STOCK_QUIT, GTK_RESPONSE_ACCEPT, NULL);
return 1;
- } else
- run_argument = argv[1];
+ }
}
- dialog = xfrun_dialog_new(run_argument);
+ dialog = xfrun_dialog_new();
xfce_gtk_window_center_on_active_screen(GTK_WINDOW(dialog));
gtk_widget_show(dialog);
g_signal_connect(G_OBJECT(dialog), "closed",
More information about the Xfce4-commits
mailing list