Skip to content
Snippets Groups Projects
Commit badc0b72 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Merge branch 'master' of...

parents 66b08677 ece74798
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@
GtkWidget*
create_shortcuts_settings()
{
GtkWidget *vbox, *result_frame, *window, *treeview, *scrolled_window, *table;
GtkWidget *vbox, *result_frame, *window, *treeview, *scrolled_window, *label;
GtkListStore *store;
GtkTreeIter iter;
guint i = 0;
......@@ -35,6 +35,8 @@ create_shortcuts_settings()
gnome_main_section_new(_("General"), &result_frame);
label = gtk_label_new(_("Be careful: these shortcuts might override system-wide shortcuts."));
treeview = gtk_tree_view_new();
setup_tree_view(treeview);
......@@ -45,7 +47,7 @@ create_shortcuts_settings()
while (list[i].action != NULL)
{
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, ACTION, list[i].action, MASK,
gtk_list_store_set(store, &iter, ACTION, _(list[i].action), MASK,
(gint) list[i].mask, VALUE, XKeycodeToKeysym(GDK_DISPLAY(),
list[i].value, 0), -1);
i++;
......@@ -55,6 +57,7 @@ create_shortcuts_settings()
g_object_unref(store);
gtk_container_add(GTK_CONTAINER (result_frame), treeview);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), result_frame, FALSE, FALSE, 0);
gtk_widget_show_all(vbox);
......@@ -85,12 +88,15 @@ setup_tree_view(GtkWidget *treeview)
gtk_tree_view_append_column(GTK_TREE_VIEW (treeview), column);
g_signal_connect (G_OBJECT (renderer), "accel_edited", G_CALLBACK (accel_edited), (gpointer) treeview);
g_signal_connect (G_OBJECT (renderer), "accel_cleared", G_CALLBACK (accel_cleared), (gpointer) treeview);
}
static void
accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
GdkModifierType mask, guint hardware_keycode, GtkTreeView *treeview)
{
DEBUG("Accel edited");
GtkTreeModel *model;
GtkTreeIter iter;
......@@ -105,3 +111,20 @@ accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
// Update GDK bindings
shortcuts_update_bindings(atoi(path), code);
}
static void
accel_cleared(GtkCellRendererAccel *renderer, gchar *path, GtkTreeView *treeview)
{
DEBUG("Accel cleared");
GtkTreeModel *model;
GtkTreeIter iter;
// Update treeview
model = gtk_tree_view_get_model(treeview);
if (gtk_tree_model_get_iter_from_string(model, &iter, path))
gtk_list_store_set(GTK_LIST_STORE (model), &iter, MASK, 0, VALUE, 0, -1);
// Update GDK bindings
shortcuts_update_bindings(atoi(path), 0);
}
......@@ -34,15 +34,19 @@ enum
};
GtkWidget*
create_shortcuts_settings();
create_shortcuts_settings ();
static void
setup_tree_view(GtkWidget *treeview);
setup_tree_view (GtkWidget *treeview);
static void
accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
accel_edited (GtkCellRendererAccel *renderer, gchar *path, guint accel_key,
GdkModifierType mask, guint hardware_keycode, GtkTreeView *treeview);
static void
accel_cleared (GtkCellRendererAccel *renderer, gchar *path,
GtkTreeView *treeview);
G_END_DECLS
#endif // _SHORTCUTS_CONFIG
......@@ -43,27 +43,28 @@ static GHashTable* shortcutsMap;
*/
static void
pick_up_callback()
pick_up_callback ()
{
sflphone_pick_up();
sflphone_pick_up ();
}
static void
hang_up_callback()
hang_up_callback ()
{
sflphone_hang_up();
sflphone_hang_up ();
}
static void
popup_window_callback()
popup_window_callback ()
{
gtk_widget_hide(GTK_WIDGET(get_main_window()));
gtk_widget_show(GTK_WIDGET(get_main_window()));
gtk_window_move (GTK_WINDOW (get_main_window ()), dbus_get_window_position_x (), dbus_get_window_position_y ());
gtk_widget_hide (GTK_WIDGET(get_main_window()));
gtk_widget_show (GTK_WIDGET(get_main_window()));
gtk_window_move (GTK_WINDOW (get_main_window ()),
dbus_get_window_position_x (), dbus_get_window_position_y ());
}
static void
default_callback()
default_callback ()
{
ERROR("Missing shortcut callback");
}
......@@ -72,15 +73,15 @@ default_callback()
* return callback corresponding to a specific action
*/
static void*
get_action_callback(const gchar* action)
get_action_callback (const gchar* action)
{
if(strcmp(action, "pick_up") == 0)
if (strcmp (action, "pick_up") == 0)
return pick_up_callback;
if(strcmp(action, "hang_up") == 0)
if (strcmp (action, "hang_up") == 0)
return hang_up_callback;
if(strcmp(action, "popup_window") == 0)
if (strcmp (action, "popup_window") == 0)
return popup_window_callback;
return default_callback;
......@@ -94,13 +95,13 @@ get_action_callback(const gchar* action)
* Remove all existing bindings
*/
static void
remove_bindings()
remove_bindings ()
{
GdkDisplay *display;
GdkScreen *screen;
GdkWindow *root;
display = gdk_display_get_default();
display = gdk_display_get_default ();
int i = 0;
int j = 0;
......@@ -108,15 +109,15 @@ remove_bindings()
{
if (accelerators_list[i].value != 0)
{
for (j = 0; j < gdk_display_get_n_screens(display); j++)
for (j = 0; j < gdk_display_get_n_screens (display); j++)
{
screen = gdk_display_get_screen(display, j);
screen = gdk_display_get_screen (display, j);
if (screen != NULL)
{
root = gdk_screen_get_root_window(screen);
ungrab_key(accelerators_list[i].value, root);
gdk_window_remove_filter(root, filter_keys, NULL);
root = gdk_screen_get_root_window (screen);
ungrab_key (accelerators_list[i].value, root);
gdk_window_remove_filter (root, filter_keys, NULL);
}
}
}
......@@ -129,13 +130,13 @@ remove_bindings()
* Create all bindings, using stored configuration
*/
static void
create_bindings()
create_bindings ()
{
GdkDisplay *display;
GdkScreen *screen;
GdkWindow *root;
display = gdk_display_get_default();
display = gdk_display_get_default ();
int i = 0;
int j = 0;
......@@ -143,23 +144,20 @@ create_bindings()
{
if (accelerators_list[i].value != 0)
{
// update value in hashtable (used for dbus calls)
g_hash_table_replace(shortcutsMap, g_strdup(accelerators_list[i].action),
GINT_TO_POINTER(accelerators_list[i].value));
// updated GDK bindings
for (j = 0; j < gdk_display_get_n_screens(display); j++)
for (j = 0; j < gdk_display_get_n_screens (display); j++)
{
screen = gdk_display_get_screen(display, j);
screen = gdk_display_get_screen (display, j);
if (screen != NULL)
{
root = gdk_screen_get_root_window(screen);
grab_key(accelerators_list[i].value, root);
gdk_window_add_filter(root, filter_keys, NULL);
root = gdk_screen_get_root_window (screen);
grab_key (accelerators_list[i].value, root);
gdk_window_add_filter (root, filter_keys, NULL);
}
}
}
i++;
}
}
......@@ -168,13 +166,13 @@ create_bindings()
* Initialize a specific binding
*/
static void
initialize_binding(const gchar* action, const guint code)
initialize_binding (const gchar* action, const guint code)
{
//initialize_shortcuts_keys();
int index = 0;
while (accelerators_list[index].action != NULL)
{
if (strcmp(action, accelerators_list[index].action) == 0)
if (strcmp (action, accelerators_list[index].action) == 0)
{
break;
}
......@@ -191,18 +189,19 @@ initialize_binding(const gchar* action, const guint code)
accelerators_list[index].value = code;
// update bindings
create_bindings();
create_bindings ();
}
/*
* Prepare accelerators list
*/
static void
initialize_accelerators_list()
initialize_accelerators_list ()
{
GList* shortcutsKeys = g_hash_table_get_keys(shortcutsMap);
GList* shortcutsKeys = g_hash_table_get_keys (shortcutsMap);
accelerators_list = (Accelerator*)malloc((g_list_length(shortcutsKeys) + 1) *sizeof(Accelerator));
accelerators_list = (Accelerator*) malloc (
(g_list_length (shortcutsKeys) + 1) * sizeof(Accelerator));
GList* shortcutsKeysElement;
int index = 0;
......@@ -211,8 +210,8 @@ initialize_accelerators_list()
{
gchar* action = shortcutsKeysElement->data;
accelerators_list[index].action = g_strdup(action);
accelerators_list[index].callback = get_action_callback(action);
accelerators_list[index].action = g_strdup (action);
accelerators_list[index].callback = get_action_callback (action);
accelerators_list[index].mask = 0;
accelerators_list[index].value = 0;
......@@ -234,43 +233,48 @@ initialize_accelerators_list()
* Update current bindings with a new value
*/
void
shortcuts_update_bindings(const guint index, const guint code)
shortcuts_update_bindings (const guint index, const guint code)
{
// first remove all existing bindings
remove_bindings();
remove_bindings ();
// store new value
accelerators_list[index].value = code;
// update value in hashtable (used for dbus calls)
g_hash_table_replace (shortcutsMap,
g_strdup (accelerators_list[index].action), GINT_TO_POINTER (
accelerators_list[index].value));
// recreate all bindings
create_bindings();
create_bindings ();
// update configuration
dbus_set_shortcuts(shortcutsMap);
dbus_set_shortcuts (shortcutsMap);
}
/*
* Initialize bindings with configuration retrieved from dbus
*/
void
shortcuts_initialize_bindings()
shortcuts_initialize_bindings ()
{
// get shortcuts stored in config through dbus
shortcutsMap = dbus_get_shortcuts();
shortcutsMap = dbus_get_shortcuts ();
// initialize list of keys
initialize_accelerators_list();
initialize_accelerators_list ();
// iterate through keys to initialize bindings
GList* shortcutsKeys = g_hash_table_get_keys(shortcutsMap);
GList* shortcutsKeys = g_hash_table_get_keys (shortcutsMap);
GList* shortcutsKeysElement;
for (shortcutsKeysElement = shortcutsKeys; shortcutsKeysElement; shortcutsKeysElement
= shortcutsKeysElement->next)
{
gchar* key = shortcutsKeysElement->data;
int shortcut = (size_t) g_hash_table_lookup(shortcutsMap, key);
if(shortcut != 0)
initialize_binding(key, shortcut);
int shortcut = (size_t) g_hash_table_lookup (shortcutsMap, key);
if (shortcut != 0)
initialize_binding (key, shortcut);
}
}
......@@ -278,23 +282,23 @@ shortcuts_initialize_bindings()
* Initialize bindings with configuration retrieved from dbus
*/
void
shortcuts_destroy_bindings()
shortcuts_destroy_bindings ()
{
// remove bindings
remove_bindings();
remove_bindings ();
// free pointers
int index = 0;
while (accelerators_list[index].action != NULL)
{
g_free(accelerators_list[index].action);
g_free (accelerators_list[index].action);
index++;
}
free(accelerators_list);
free (accelerators_list);
}
Accelerator*
shortcuts_get_list()
shortcuts_get_list ()
{
return accelerators_list;
}
......@@ -307,7 +311,7 @@ shortcuts_get_list()
* filter used when an event is catched
*/
static GdkFilterReturn
filter_keys(GdkXEvent *xevent, GdkEvent *event, gpointer data)
filter_keys (GdkXEvent *xevent, GdkEvent *event, gpointer data)
{
XEvent *xev;
XKeyEvent *key;
......@@ -330,7 +334,7 @@ filter_keys(GdkXEvent *xevent, GdkEvent *event, gpointer data)
accelerators_list[i].value);
// call associated callback function
accelerators_list[i].callback();
accelerators_list[i].callback ();
return GDK_FILTER_REMOVE;
}
......@@ -345,22 +349,25 @@ filter_keys(GdkXEvent *xevent, GdkEvent *event, gpointer data)
* Remove key "catcher" from GDK layer
*/
static void
ungrab_key(int key_code, GdkWindow *root)
ungrab_key (int key_code, GdkWindow *root)
{
gdk_error_trap_push();
XUngrabKey(GDK_DISPLAY(), key_code, 0, GDK_WINDOW_XID(root));
XUngrabKey(GDK_DISPLAY(), key_code, Mod2Mask, GDK_WINDOW_XID(root));
XUngrabKey(GDK_DISPLAY(), key_code, Mod5Mask, GDK_WINDOW_XID(root));
XUngrabKey(GDK_DISPLAY(), key_code, LockMask, GDK_WINDOW_XID(root));
XUngrabKey(GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask, GDK_WINDOW_XID(root));
XUngrabKey(GDK_DISPLAY(), key_code, Mod2Mask | LockMask, GDK_WINDOW_XID(root));
XUngrabKey(GDK_DISPLAY(), key_code, Mod5Mask | LockMask, GDK_WINDOW_XID(root));
XUngrabKey(GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask | LockMask,
gdk_error_trap_push ();
XUngrabKey (GDK_DISPLAY(), key_code, 0, GDK_WINDOW_XID(root));
XUngrabKey (GDK_DISPLAY(), key_code, Mod2Mask, GDK_WINDOW_XID(root));
XUngrabKey (GDK_DISPLAY(), key_code, Mod5Mask, GDK_WINDOW_XID(root));
XUngrabKey (GDK_DISPLAY(), key_code, LockMask, GDK_WINDOW_XID(root));
XUngrabKey (GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask,
GDK_WINDOW_XID(root));
XUngrabKey (GDK_DISPLAY(), key_code, Mod2Mask | LockMask,
GDK_WINDOW_XID(root));
XUngrabKey (GDK_DISPLAY(), key_code, Mod5Mask | LockMask,
GDK_WINDOW_XID(root));
XUngrabKey (GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask | LockMask,
GDK_WINDOW_XID(root));
gdk_flush();
if (gdk_error_trap_pop())
gdk_flush ();
if (gdk_error_trap_pop ())
{
ERROR("Error ungrabbing key");
}
......@@ -370,30 +377,30 @@ ungrab_key(int key_code, GdkWindow *root)
* Add key "catcher" to GDK layer
*/
static void
grab_key(int key_code, GdkWindow *root)
grab_key (int key_code, GdkWindow *root)
{
gdk_error_trap_push();
gdk_error_trap_push ();
XGrabKey(GDK_DISPLAY(), key_code, 0, GDK_WINDOW_XID(root), True,
XGrabKey (GDK_DISPLAY(), key_code, 0, GDK_WINDOW_XID(root), True,
GrabModeAsync, GrabModeAsync);
XGrabKey(GDK_DISPLAY(), key_code, Mod2Mask, GDK_WINDOW_XID(root), True,
XGrabKey (GDK_DISPLAY(), key_code, Mod2Mask, GDK_WINDOW_XID(root), True,
GrabModeAsync, GrabModeAsync);
XGrabKey(GDK_DISPLAY(), key_code, Mod5Mask, GDK_WINDOW_XID(root), True,
XGrabKey (GDK_DISPLAY(), key_code, Mod5Mask, GDK_WINDOW_XID(root), True,
GrabModeAsync, GrabModeAsync);
XGrabKey(GDK_DISPLAY(), key_code, LockMask, GDK_WINDOW_XID(root), True,
XGrabKey (GDK_DISPLAY(), key_code, LockMask, GDK_WINDOW_XID(root), True,
GrabModeAsync, GrabModeAsync);
XGrabKey(GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask, GDK_WINDOW_XID(root),
XGrabKey (GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask, GDK_WINDOW_XID(root),
True, GrabModeAsync, GrabModeAsync);
XGrabKey(GDK_DISPLAY(), key_code, Mod2Mask | LockMask, GDK_WINDOW_XID(root),
XGrabKey (GDK_DISPLAY(), key_code, Mod2Mask | LockMask, GDK_WINDOW_XID(root),
True, GrabModeAsync, GrabModeAsync);
XGrabKey(GDK_DISPLAY(), key_code, Mod5Mask | LockMask, GDK_WINDOW_XID(root),
XGrabKey (GDK_DISPLAY(), key_code, Mod5Mask | LockMask, GDK_WINDOW_XID(root),
True, GrabModeAsync, GrabModeAsync);
XGrabKey(GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask | LockMask,
XGrabKey (GDK_DISPLAY(), key_code, Mod2Mask | Mod5Mask | LockMask,
GDK_WINDOW_XID(root), True, GrabModeAsync, GrabModeAsync);
gdk_flush();
if (gdk_error_trap_pop())
gdk_flush ();
if (gdk_error_trap_pop ())
{
ERROR("Error grabbing key");
}
......
......@@ -26,3 +26,10 @@ incoming = ~savoirfairelinux/sflphone-nightly/ubuntu/karmic
login = anonymous
allow_unsigned_uploads = 0
[sflphone-nightly-lucid]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~savoirfairelinux/sflphone-nightly/ubuntu/lucid
login = anonymous
allow_unsigned_uploads = 0
Source: sflphone-client-gnome
Maintainer: SavoirFaireLinux Inc <julien.bonjean@savoirfairelinux.com>
Section: gnome
Priority: optional
Build-Depends: debhelper, libgcc1, autoconf, automake, libtool, libgtk2.0-dev, libdbus-glib-1-dev, libnotify-dev, libebook1.2-dev, check, liblog4c-dev, libgnomeui-dev, gnome-doc-utils, rarian-compat
Standards-Version: 3.7.3
Package: sflphone-client-gnome
Priority: optional
Architecture: any
Depends: sflphone-common (=${source:Version}), libdbus-glib-1-2, libgtk2.0-0, libc6, libglib2.0-0, libdbus-glib-1-2, libnotify1, librsvg2-common, liblog4c3, libebook1.2-9, libgnomeui-0
Replaces: sflphone
Conflicts: sflphone
Homepage: http://www.sflphone.org
Description: GNOME client for SFLphone
Provide a GNOME client for SFLphone.
SFLphone is meant to be a robust enterprise-class desktop phone.
SFLphone is released under the GNU General Public License.
SFLphone is being developed by the global community, and maintained by
Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company.
Source: sflphone-common
Maintainer: SavoirFaireLinux Inc <julien.bonjean@savoirfairelinux.com>
Section: gnome
Priority: optional
Build-Depends: debhelper, libgcc1 , autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libgsm1-dev, libspeex-dev, libtool, libdbus-1-dev, libasound2-dev, libspeexdsp-dev, uuid-dev, libexpat1-dev, libzrtpcpp-dev, libssl-dev, libpcre3-dev
Standards-Version: 3.7.3
Package: sflphone-common
Priority: optional
Architecture: any
Depends: libsamplerate0, libexpat1 , libc6, libccgnu2-1.7-0, libgsm1, libspeex1, libdbus-1-3, libasound2, libpulse0, libccrtp1-1.7-0, libspeexdsp1, libzrtpcpp-1.4-0, libssl0.9.8, libpcre3
Replaces: sflphone
Conflicts: sflphone
Homepage: http://www.sflphone.org
Description: SIP and IAX2 compatible softphone - Core
SFLphone is meant to be a robust enterprise-class desktop phone.
SFLphone is released under the GNU General Public License.
SFLphone is being developed by the global community, and maintained by
Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company.
......@@ -22,6 +22,6 @@ export REFERENCE_REPOSITORY="${ROOT_DIR}/sflphone-source-repository"
export WORKING_DIR="${ROOT_DIR}/sflphone-build-repository/tools/build-system"
export LAUNCHPAD_DIR="${WORKING_DIR}/launchpad"
LAUNCHPAD_DISTRIBUTIONS=( "jaunty" "karmic" )
LAUNCHPAD_DISTRIBUTIONS=( "jaunty" "karmic" "lucid" )
export LAUNCHPAD_DISTRIBUTIONS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment