Skip to content
Snippets Groups Projects
Commit e9ae581b authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

[ #13640 ] Add 'hook' setting for messaging

parent 6bbefadb
No related branches found
No related tags found
No related merge requests found
...@@ -32,11 +32,12 @@ ...@@ -32,11 +32,12 @@
#include "gtk2_wrappers.h" #include "gtk2_wrappers.h"
#include "str_utils.h" #include "str_utils.h"
#include "hooks-config.h" #include "hooks-config.h"
#include "eel-gconf-extensions.h"
#include "dbus.h" #include "dbus.h"
URLHook_Config *_urlhook_config; URLHook_Config *_urlhook_config;
GtkWidget *field, *command, *prefix; GtkWidget *field, *command, *prefix, *url;
void hooks_load_parameters(URLHook_Config** settings) void hooks_load_parameters(URLHook_Config** settings)
{ {
...@@ -94,6 +95,8 @@ void hooks_save_parameters(void) ...@@ -94,6 +95,8 @@ void hooks_save_parameters(void)
// Decrement the reference count // Decrement the reference count
g_hash_table_unref(params); g_hash_table_unref(params);
eel_gconf_set_string(MESSAGING_URL_COMMAND, gtk_entry_get_text(GTK_ENTRY(url)));
} }
static void sip_enabled_cb(GtkWidget *widget) static void sip_enabled_cb(GtkWidget *widget)
...@@ -194,6 +197,21 @@ GtkWidget* create_hooks_settings() ...@@ -194,6 +197,21 @@ GtkWidget* create_hooks_settings()
gtk_widget_set_sensitive(GTK_WIDGET(prefix), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widg))); gtk_widget_set_sensitive(GTK_WIDGET(prefix), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widg)));
gtk_table_attach(GTK_TABLE(table), prefix, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10); gtk_table_attach(GTK_TABLE(table), prefix, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10);
gnome_main_section_new_with_table(_("Messaging"), &frame, &table, 4, 2);
gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
gtk_widget_show(frame);
label = gtk_label_new_with_mnemonic(_("Open URL in"));
url = gtk_entry_new();
gchar *url_command = eel_gconf_get_string(MESSAGING_URL_COMMAND);
if (strlen(url_command))
gtk_entry_set_text(GTK_ENTRY(url),url_command);
else
gtk_entry_set_text(GTK_ENTRY(url), "xdg-open");
gtk_label_set_mnemonic_widget(GTK_LABEL(label), url);
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10);
gtk_table_attach(GTK_TABLE(table), url , 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10);
gtk_widget_show_all(ret); gtk_widget_show_all(ret);
return ret; return ret;
... ...
......
...@@ -54,6 +54,7 @@ BEGIN_EXTERN_C ...@@ -54,6 +54,7 @@ BEGIN_EXTERN_C
#define POPUP_ON_CALL CONF_PREFIX "/state/popup" #define POPUP_ON_CALL CONF_PREFIX "/state/popup"
#define HISTORY_ENABLED CONF_PREFIX "/state/history" #define HISTORY_ENABLED CONF_PREFIX "/state/history"
#define INSTANT_MESSAGING_ENABLED CONF_PREFIX "/state/instant_messaging" #define INSTANT_MESSAGING_ENABLED CONF_PREFIX "/state/instant_messaging"
#define MESSAGING_URL_COMMAND CONF_PREFIX "/hook/url_command"
#define EEL_GCONF_UNDEFINED_CONNECTION 0 #define EEL_GCONF_UNDEFINED_CONNECTION 0
... ...
......
...@@ -4,8 +4,8 @@ noinst_LTLIBRARIES = libmessaging.la ...@@ -4,8 +4,8 @@ noinst_LTLIBRARIES = libmessaging.la
libmessaging_la_SOURCES = message_tab.c message_tab.h libmessaging_la_SOURCES = message_tab.c message_tab.h
libmessaging_la_LDFLAGS = libmessaging_la_LDFLAGS = $(GCONF_LDFLAGS) $(GTK_LDFLAGS) $(GLIB_LDFLAGS) $(DBUSGLIB_LDFLAGS)
libmessaging_la_LIBADD = @GTK_LIBS@ @GLIB_LIBS@ libmessaging_la_LIBADD = @GTK_LIBS@ @GLIB_LIBS@ $(GCONF_LIBS) $(DBUSGLIB_LIBS)
libmessaging_la_CFLAGS = @GTK_CFLAGS@ @GLIB_CFLAGS@ @DBUSGLIB_CFLAGS@ libmessaging_la_CFLAGS = @GTK_CFLAGS@ @GLIB_CFLAGS@ @DBUSGLIB_CFLAGS@ $(GCONF_CFLAGS)
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "../dbus/dbus.h" #include "../dbus/dbus.h"
#include <glib.h> #include <glib.h>
#include "../mainwindow.h" #include "../mainwindow.h"
#include "eel-gconf-extensions.h"
#include <string.h> #include <string.h>
static GtkWidget *tab_box = NULL ; static GtkWidget *tab_box = NULL ;
...@@ -195,7 +196,10 @@ on_clicked(GtkTextBuffer *textbuffer UNUSED, GtkTextIter *location UNUSED, GtkTe ...@@ -195,7 +196,10 @@ on_clicked(GtkTextBuffer *textbuffer UNUSED, GtkTextIter *location UNUSED, GtkTe
start_link = NULL; start_link = NULL;
end_link = NULL; end_link = NULL;
if (strlen(text)) { if (strlen(text)) {
const gchar* argv[3] = {"x-www-browser",text,(char*)NULL}; gchar* url_command = eel_gconf_get_string(MESSAGING_URL_COMMAND);
if (!strlen(url_command))
url_command = "xdg-open";
const gchar* argv[3] = {url_command,text,(char*)NULL};
g_spawn_async(NULL,(gchar**)argv,NULL,G_SPAWN_SEARCH_PATH|G_SPAWN_STDOUT_TO_DEV_NULL|G_SPAWN_STDERR_TO_DEV_NULL,NULL,NULL,NULL,NULL); g_spawn_async(NULL,(gchar**)argv,NULL,G_SPAWN_SEARCH_PATH|G_SPAWN_STDOUT_TO_DEV_NULL|G_SPAWN_STDERR_TO_DEV_NULL,NULL,NULL,NULL,NULL);
} }
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment