- now the logic is in the python code, so wizard doesn't have to know about whats behind the screencasting --- src/gui-wizard-gtk/wizard.c | 49 +++++++++++++++++++++++++++++++++++++++------ src/plugins/abrt-screencast | 10 +++++++++ 2 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index d790f7d..52aff11 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -3075,6 +3075,30 @@ static void on_btn_startcast(GtkWidget *btn, gpointer user_data) gtk_widget_show(GTK_WIDGET(g_wnd_assistant)); }
+bool is_screencast_available() +{ + const char *args[3]; + args[0] = (char *) LIBEXEC_DIR"/abrt-screencast"; + args[1] = "is-available"; + args[2] = NULL; + + pid_t castapp = 0; + castapp = fork_execv_on_steroids( + EXECFLG_QUIET, + (char **)args, + NULL, + /*env_vec:*/ NULL, + /*dir:*/ NULL, + /*uid (ignored):*/ 0 + ); + + int status; + safe_waitpid(castapp, &status, 0); + + /* 0 means that it's available */ + return status == 0; +} + void create_assistant(bool expert_mode) { g_loaded_texts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); @@ -3164,12 +3188,25 @@ void create_assistant(bool expert_mode)
g_signal_connect(g_btn_add_file, "clicked", G_CALLBACK(on_btn_add_file), NULL);
- /* we need to override the activate-link handler, because we use - * the link button instead of normal button and if wouldn't override it - * gtk would try to run it's defualt action and open the associated URI - * but since the URI is empty it would complain about it... - */ - g_signal_connect(g_btn_startcast, "activate-link", G_CALLBACK(on_btn_startcast), NULL); + if (is_screencast_available()) { + /* we need to override the activate-link handler, because we use + * the link button instead of normal button and if we wouldn't override it + * gtk would try to run it's defualt action and open the associated URI + * but since the URI is empty it would complain about it... + */ + g_signal_connect(g_btn_startcast, "activate-link", G_CALLBACK(on_btn_startcast), NULL); + } + else { + gtk_widget_set_sensitive(GTK_WIDGET(g_btn_startcast), false); + gtk_widget_set_tooltip_markup(GTK_WIDGET(g_btn_startcast), + _("In order to enable the built-in screencasting " + "functionality the package recordmydesktop has to be installed. " + "Please run the following command if you want to install it." + "\n\n" + "<b>su -c "yum install recordmydesktop"</b>" + )); + } +
g_signal_connect(g_search_entry_bt, "changed", G_CALLBACK(search_timeout), NULL);
diff --git a/src/plugins/abrt-screencast b/src/plugins/abrt-screencast index 0511a65..bf3746a 100644 --- a/src/plugins/abrt-screencast +++ b/src/plugins/abrt-screencast @@ -235,9 +235,19 @@ class AbrtScreecastWindow(Gtk.Window): # pylint: disable=E1101 self.present() #move it on top or do some magic to drag the attention
+def is_available(): + for path in os.environ["PATH"].split(':'): + if os.path.exists(path+"/recordmydesktop"): + return True + + return False
if __name__ == "__main__": output_file = None + if sys.argv[1] == "is-available": + exitcode = 0 if is_available() else 1 + sys.exit(exitcode) + try: output_file = sys.argv[1] except IndexError, ex: