Commit 15bde38e authored by Marc-André Moreau's avatar Marc-André Moreau

remmina: code style cleanup

parent 480f6bc1
......@@ -196,7 +196,7 @@ static void remmina_nx_session_set_application_error(RemminaNXSession *nx, const
{
va_list args;
if (nx->error) g_free (nx->error);
if (nx->error) g_free(nx->error);
va_start (args, fmt);
nx->error = g_strdup_vprintf (fmt, args);
va_end (args);
......@@ -525,7 +525,7 @@ static void remmina_nx_session_send_command(RemminaNXSession *nx, const gchar *c
va_start (args, cmdfmt);
cmd = g_strdup_vprintf (cmdfmt, args);
channel_write (nx->channel, cmd, strlen (cmd));
g_free (cmd);
g_free(cmd);
ssh_set_fd_towrite (nx->session);
channel_write (nx->channel, "\n", 1);
......@@ -666,7 +666,7 @@ void remmina_nx_session_add_parameter(RemminaNXSession *nx, const gchar *name, c
va_start (args, valuefmt);
value = g_strdup_vprintf (valuefmt, args);
g_hash_table_insert (nx->session_parameters, g_strdup (name), value);
g_hash_table_insert(nx->session_parameters, g_strdup (name), value);
}
static gboolean remmina_nx_session_send_session_command(RemminaNXSession *nx, const gchar *cmd_type, gint response)
......
......@@ -675,7 +675,7 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
rfi->settings->directory = xstrdup(remmina_plugin_service->file_get_string(remminafile, "execpath"));
}
s = g_strdup_printf ("rdp_quality_%i", remmina_plugin_service->file_get_int(remminafile, "quality", DEFAULT_QUALITY_0));
s = g_strdup_printf("rdp_quality_%i", remmina_plugin_service->file_get_int(remminafile, "quality", DEFAULT_QUALITY_0));
value = remmina_plugin_service->pref_get_value(s);
g_free(s);
......
......@@ -26,8 +26,7 @@ set_target_properties(remmina-plugin-telepathy PROPERTIES PREFIX "")
find_required_package(GTK3)
include_directories(${REMMINA_COMMON_INCLUDE_DIRS})
target_link_libraries(remmina-plugin-telepathy ${REMMINA_COMMON_LIBRARIES})
include_directories(${REMMINA_COMMON_INCLUDE_DIRS} ${TELEPATHY_INCLUDE_DIRS})
target_link_libraries(remmina-plugin-telepathy ${REMMINA_COMMON_LIBRARIES} ${TELEPATHY_LIBRARIES})
install(TARGETS remmina-plugin-telepathy DESTINATION ${REMMINA_PLUGINDIR})
......@@ -86,9 +86,9 @@ G_DEFINE_TYPE_WITH_CODE (RemminaTpHandler, remmina_tp_handler, G_TYPE_OBJECT,
g_object_unref(bus);
g_print("tp_dbus_daemon_request_name: %s", error->message);
return FALSE;
} dbus_g_connection_register_g_object (
} dbus_g_connection_register_G_OBJECT(
tp_proxy_get_dbus_connection (TP_PROXY (bus)),
REMMINA_TP_OBJECT_PATH, G_OBJECT (handler));
REMMINA_TP_OBJECT_PATH, G_OBJECT(handler));
g_object_unref(bus);
g_print("remmina_tp_handler_register: bus_name " REMMINA_TP_BUS_NAME
" object_path " REMMINA_TP_OBJECT_PATH "\n");
......
......@@ -839,7 +839,7 @@ remmina_plugin_vnc_rfb_credential (rfbClient *cl, int credentialType)
gchar *s1, *s2;
gp = (RemminaProtocolWidget*) (rfbClientGetClientData (cl, NULL));
gpdata = (RemminaPluginVncData*) g_object_get_data (G_OBJECT (gp), "plugin-data");
gpdata = (RemminaPluginVncData*) g_object_get_data (G_OBJECT(gp), "plugin-data");
gpdata->auth_called = TRUE;
remminafile = remmina_plugin_service->protocol_plugin_get_file (gp);
......@@ -861,8 +861,8 @@ remmina_plugin_vnc_rfb_credential (rfbClient *cl, int credentialType)
}
else
{
g_free (s1);
g_free (s2);
g_free(s1);
g_free(s2);
THREADS_ENTER
ret = remmina_plugin_service->protocol_plugin_init_authuserpwd (gp, FALSE);
......@@ -875,7 +875,7 @@ remmina_plugin_vnc_rfb_credential (rfbClient *cl, int credentialType)
}
else
{
g_free (cred);
g_free(cred);
cred = NULL;
gpdata->connected = FALSE;
}
......@@ -906,7 +906,7 @@ remmina_plugin_vnc_rfb_credential (rfbClient *cl, int credentialType)
}
else
{
g_free (cred);
g_free(cred);
cred = NULL;
gpdata->connected = FALSE;
}
......@@ -914,7 +914,7 @@ remmina_plugin_vnc_rfb_credential (rfbClient *cl, int credentialType)
break;
default:
g_free (cred);
g_free(cred);
cred = NULL;
break;
}
......@@ -990,7 +990,7 @@ static void remmina_plugin_vnc_rfb_output(const char *format, ...)
{
g_vsnprintf (vnc_error, MAX_ERROR_LENGTH, _(f), args);
}
g_free (f);
g_free(f);
va_end(args);
remmina_plugin_service->log_printf ("[VNC]%s\n", vnc_error);
......@@ -1226,7 +1226,7 @@ static gboolean remmina_plugin_vnc_main(RemminaProtocolWidget *gp)
remmina_plugin_service->get_server_port (remmina_plugin_service->file_get_string (remminafile, "proxy"), 5900,
&s, &cl->serverPort);
cl->serverHost = strdup (s);
g_free (s);
g_free(s);
#endif
}
......@@ -1605,7 +1605,7 @@ static gboolean remmina_plugin_vnc_open_connection(RemminaProtocolWidget *gp)
if (pthread_create (&gpdata->thread, NULL, remmina_plugin_vnc_main_thread, gp))
{
/* I don't think this will ever happen... */
g_print ("Failed to initialize pthread. Falling back to non-thread mode...\n");
g_print("Failed to initialize pthread. Falling back to non-thread mode...\n");
g_timeout_add (0, (GSourceFunc) remmina_plugin_vnc_main, gp);
gpdata->thread = 0;
}
......
......@@ -43,25 +43,25 @@ typedef struct _RemminaAppletMenu
{
GtkMenu menu;
RemminaAppletMenuPriv *priv;
RemminaAppletMenuPriv* priv;
} RemminaAppletMenu;
typedef struct _RemminaAppletMenuClass
{
GtkMenuClass parent_class;
void (*launch_item)(RemminaAppletMenu *menu);
void (*edit_item)(RemminaAppletMenu *menu);
void (*launch_item)(RemminaAppletMenu* menu);
void (*edit_item)(RemminaAppletMenu* menu);
} RemminaAppletMenuClass;
GType remmina_applet_menu_get_type(void)
G_GNUC_CONST;
void remmina_applet_menu_register_item(RemminaAppletMenu *menu, RemminaAppletMenuItem *menuitem);
void remmina_applet_menu_add_item(RemminaAppletMenu *menu, RemminaAppletMenuItem *menuitem);
void remmina_applet_menu_register_item(RemminaAppletMenu* menu, RemminaAppletMenuItem* menuitem);
void remmina_applet_menu_add_item(RemminaAppletMenu* menu, RemminaAppletMenuItem* menuitem);
GtkWidget* remmina_applet_menu_new(void);
void remmina_applet_menu_set_hide_count(RemminaAppletMenu *menu, gboolean hide_count);
void remmina_applet_menu_populate(RemminaAppletMenu *menu);
void remmina_applet_menu_set_hide_count(RemminaAppletMenu* menu, gboolean hide_count);
void remmina_applet_menu_populate(RemminaAppletMenu* menu);
G_END_DECLS
......
......@@ -100,10 +100,10 @@ GtkWidget* remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ...
va_end(ap);
/* Create the label */
widget = gtk_label_new (item->name);
widget = gtk_label_new(item->name);
gtk_widget_show(widget);
gtk_misc_set_alignment(GTK_MISC (widget), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (item), widget);
gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
gtk_container_add(GTK_CONTAINER(item), widget);
/* Create the image */
if (item_type == REMMINA_APPLET_MENU_ITEM_FILE || item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED)
......
......@@ -32,135 +32,134 @@
struct _RemminaAvahiPriv
{
AvahiSimplePoll *simple_poll;
AvahiClient *client;
AvahiServiceBrowser *sb;
AvahiSimplePoll* simple_poll;
AvahiClient* client;
AvahiServiceBrowser* sb;
guint iterate_handler;
gboolean has_event;
};
static void
remmina_avahi_resolve_callback (
AvahiServiceResolver *r,
remmina_avahi_resolve_callback(
AvahiServiceResolver* r,
AVAHI_GCC_UNUSED AvahiIfIndex interface,
AVAHI_GCC_UNUSED AvahiProtocol protocol,
AvahiResolverEvent event,
const char *name,
const char *type,
const char *domain,
const char *host_name,
const AvahiAddress *address,
const char* name,
const char* type,
const char* domain,
const char* host_name,
const AvahiAddress* address,
uint16_t port,
AvahiStringList *txt,
AvahiStringList* txt,
AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata)
{
RemminaAvahi *ga = (RemminaAvahi*) userdata;
gchar *key, *value;
gchar* key;
gchar* value;
RemminaAvahi* ga = (RemminaAvahi*) userdata;
assert (r);
assert(r);
ga->priv->has_event = TRUE;
switch (event)
{
case AVAHI_RESOLVER_FAILURE:
g_print ("(remmina-applet avahi-resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n",
name, type, domain, avahi_strerror (avahi_client_errno (avahi_service_resolver_get_client (r))));
break;
case AVAHI_RESOLVER_FOUND:
key = g_strdup_printf ("%s,%s,%s", name, type, domain);
if (g_hash_table_lookup (ga->discovered_services, key))
{
g_free (key);
g_print("(remmina-applet avahi-resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n",
name, type, domain, avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r))));
break;
}
value = g_strdup_printf ("[%s]:%i", host_name, port);
g_hash_table_insert (ga->discovered_services, key, value);
/* key and value will be freed with g_free when the has table is freed */
g_print ("(remmina-applet avahi-resolver) Added service '%s'\n", value);
case AVAHI_RESOLVER_FOUND:
key = g_strdup_printf("%s,%s,%s", name, type, domain);
if (g_hash_table_lookup(ga->discovered_services, key))
{
g_free(key);
break;
}
value = g_strdup_printf("[%s]:%i", host_name, port);
g_hash_table_insert(ga->discovered_services, key, value);
/* key and value will be freed with g_free when the has table is freed */
g_print("(remmina-applet avahi-resolver) Added service '%s'\n", value);
break;
break;
}
avahi_service_resolver_free (r);
avahi_service_resolver_free(r);
}
static void
remmina_avahi_browse_callback (
AvahiServiceBrowser *b,
remmina_avahi_browse_callback(
AvahiServiceBrowser* b,
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiBrowserEvent event,
const char *name,
const char *type,
const char *domain,
const char* name,
const char* type,
const char* domain,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void* userdata)
{
RemminaAvahi *ga = (RemminaAvahi*) userdata;
gchar *key;
gchar* key;
RemminaAvahi* ga = (RemminaAvahi*) userdata;
assert (b);
assert(b);
ga->priv->has_event = TRUE;
switch (event)
{
case AVAHI_BROWSER_FAILURE:
g_print ("(remmina-applet avahi-browser) %s\n",
avahi_strerror (avahi_client_errno (avahi_service_browser_get_client (b))));
return;
g_print("(remmina-applet avahi-browser) %s\n",
avahi_strerror(avahi_client_errno (avahi_service_browser_get_client (b))));
return;
case AVAHI_BROWSER_NEW:
key = g_strdup_printf ("%s,%s,%s", name, type, domain);
if (g_hash_table_lookup (ga->discovered_services, key))
{
g_free (key);
key = g_strdup_printf("%s,%s,%s", name, type, domain);
if (g_hash_table_lookup(ga->discovered_services, key))
{
g_free(key);
break;
}
g_free(key);
g_print("(remmina-applet avahi-browser) Found service '%s' of type '%s' in domain '%s'\n", name, type, domain);
if (!(avahi_service_resolver_new(ga->priv->client, interface, protocol, name, type, domain,
AVAHI_PROTO_UNSPEC, 0, remmina_avahi_resolve_callback, ga)))
{
g_print("(remmina-applet avahi-browser) Failed to resolve service '%s': %s\n",
name, avahi_strerror(avahi_client_errno (ga->priv->client)));
}
break;
}
g_free (key);
g_print ("(remmina-applet avahi-browser) Found service '%s' of type '%s' in domain '%s'\n", name, type, domain);
if (!(avahi_service_resolver_new (ga->priv->client, interface, protocol, name, type, domain,
AVAHI_PROTO_UNSPEC, 0, remmina_avahi_resolve_callback, ga)))
{
g_print ("(remmina-applet avahi-browser) Failed to resolve service '%s': %s\n",
name, avahi_strerror (avahi_client_errno (ga->priv->client)));
}
break;
case AVAHI_BROWSER_REMOVE:
g_print ("(remmina-applet avahi-browser) Removed service '%s' of type '%s' in domain '%s'\n", name, type, domain);
key = g_strdup_printf ("%s,%s,%s", name, type, domain);
g_hash_table_remove (ga->discovered_services, key);
g_free (key);
break;
g_print("(remmina-applet avahi-browser) Removed service '%s' of type '%s' in domain '%s'\n", name, type, domain);
key = g_strdup_printf("%s,%s,%s", name, type, domain);
g_hash_table_remove(ga->discovered_services, key);
g_free(key);
break;
case AVAHI_BROWSER_ALL_FOR_NOW:
case AVAHI_BROWSER_CACHE_EXHAUSTED:
break;
break;
}
}
static void
remmina_avahi_client_callback (AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata)
static void remmina_avahi_client_callback(AvahiClient* c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata)
{
RemminaAvahi *ga = (RemminaAvahi*) userdata;
RemminaAvahi* ga = (RemminaAvahi*) userdata;
ga->priv->has_event = TRUE;
if (state == AVAHI_CLIENT_FAILURE)
{
g_print ("(remmina-applet avahi) Server connection failure: %s\n", avahi_strerror (avahi_client_errno (c)));
g_print("(remmina-applet avahi) Server connection failure: %s\n", avahi_strerror(avahi_client_errno(c)));
}
}
static gboolean remmina_avahi_iterate(RemminaAvahi *ga)
static gboolean remmina_avahi_iterate(RemminaAvahi* ga)
{
while (TRUE)
{
......@@ -174,10 +173,9 @@ static gboolean remmina_avahi_iterate(RemminaAvahi *ga)
return TRUE;
}
RemminaAvahi*
remmina_avahi_new(void)
RemminaAvahi* remmina_avahi_new(void)
{
RemminaAvahi *ga;
RemminaAvahi* ga;
ga = g_new(RemminaAvahi, 1);
ga->discovered_services = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
......@@ -258,7 +256,9 @@ void remmina_avahi_free(RemminaAvahi* ga)
{
if (ga == NULL)
return;
remmina_avahi_stop(ga);
g_free(ga->priv);
g_hash_table_destroy(ga->discovered_services);
g_free(ga);
......@@ -266,8 +266,7 @@ void remmina_avahi_free(RemminaAvahi* ga)
#else
RemminaAvahi*
remmina_avahi_new(void)
RemminaAvahi* remmina_avahi_new(void)
{
return NULL;
}
......
......@@ -23,137 +23,145 @@
G_DEFINE_TYPE (RemminaChainButton, remmina_chain_button, GTK_TYPE_TABLE)
static const gchar * line_up_xpm[] = {
"9 7 3 1",
" c None",
". c #A9A5A2",
"+ c #FFFFFF",
"..... ",
"+++++. ",
" +. ",
" +. ",
" +. ",
" +. ",
" "};
static const gchar * line_down_xpm[] = {
"9 7 3 1",
" c None",
". c #FFFFFF",
"+ c #A9A5A2",
" ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
".....+ ",
"+++++ "};
static const gchar * vchain_xpm[] = {
"9 24 13 1",
" c None",
". c #555753",
"+ c #8D8D8E",
"@ c #E8E8E9",
"# c #8E8E90",
"$ c #888A85",
"% c #8F8F91",
"& c #2E3436",
"* c #EEEEEC",
"= c #989899",
"- c #959597",
"; c #9D9D9E",
"> c #B9B9BA",
" ",
" ",
" ..... ",
" .+@@@#. ",
" .@...@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@.$.@. ",
" .%&*$%. ",
" .&*$. ",
" &*$ ",
" &*$ ",
" .&*$. ",
" .=&*$-. ",
" .@.&.@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@...@. ",
" .;@@@>. ",
" ..... ",
" ",
" "};
static const gchar * vchain_broken_xpm[] = {
"9 24 13 1",
" c None",
". c #555753",
"+ c #8D8D8E",
"@ c #E8E8E9",
"# c #8E8E90",
"$ c #888A85",
"% c #8F8F91",
"& c #2E3436",
"* c #EEEEEC",
"= c #989899",
"- c #959597",
"; c #9D9D9E",
"> c #B9B9BA",
" ..... ",
" .+@@@#. ",
" .@...@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@.$.@. ",
" .%&*$%. ",
" .&*$. ",
" &*$ ",
" ",
" ",
" ",
" ",
" &*$ ",
" .&*$. ",
" .=&*$-. ",
" .@.&.@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@...@. ",
" .;@@@>. ",
" ..... "};
static const gchar* line_up_xpm[] =
{
"9 7 3 1",
" c None",
". c #A9A5A2",
"+ c #FFFFFF",
"..... ",
"+++++. ",
" +. ",
" +. ",
" +. ",
" +. ",
" "
};
static const gchar* line_down_xpm[] =
{
"9 7 3 1",
" c None",
". c #FFFFFF",
"+ c #A9A5A2",
" ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
".....+ ",
"+++++ "
};
static const gchar* vchain_xpm[] =
{
"9 24 13 1",
" c None",
". c #555753",
"+ c #8D8D8E",
"@ c #E8E8E9",
"# c #8E8E90",
"$ c #888A85",
"% c #8F8F91",
"& c #2E3436",
"* c #EEEEEC",
"= c #989899",
"- c #959597",
"; c #9D9D9E",
"> c #B9B9BA",
" ",
" ",
" ..... ",
" .+@@@#. ",
" .@...@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@.$.@. ",
" .%&*$%. ",
" .&*$. ",
" &*$ ",
" &*$ ",
" .&*$. ",
" .=&*$-. ",
" .@.&.@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@...@. ",
" .;@@@>. ",
" ..... ",
" ",
" "
};
static const gchar* vchain_broken_xpm[] =
{
"9 24 13 1",
" c None",
". c #555753",
"+ c #8D8D8E",
"@ c #E8E8E9",
"# c #8E8E90",
"$ c #888A85",
"% c #8F8F91",
"& c #2E3436",
"* c #EEEEEC",
"= c #989899",
"- c #959597",
"; c #9D9D9E",
"> c #B9B9BA",
" ..... ",
" .+@@@#. ",
" .@...@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@.$.@. ",
" .%&*$%. ",
" .&*$. ",
" &*$ ",
" ",
" ",
" ",
" ",
" &*$ ",
" .&*$. ",
" .=&*$-. ",
" .@.&.@. ",
" .@. .@. ",
" .@. .@. ",
" .@. .@. ",
" .@...@. ",
" .;@@@>. ",
" ..... "
};
enum
{
CHAIN_TOGGLED_SIGNAL, LAST_SIGNAL
CHAIN_TOGGLED_SIGNAL,
LAST_SIGNAL
};
static guint remmina_chain_button_signals[LAST_SIGNAL] =
{ 0 };
static guint remmina_chain_button_signals[LAST_SIGNAL] = { 0 };
static void remmina_chain_button_class_init(RemminaChainButtonClass *klass)
static void remmina_chain_button_class_init(RemminaChainButtonClass* klass)
{
remmina_chain_button_signals[CHAIN_TOGGLED_SIGNAL] = g_signal_new("chain-toggled", G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaChainButtonClass, chain_toggled), NULL,
NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void remmina_chain_button_update_chained(RemminaChainButton *cb)
static void remmina_chain_button_update_chained(RemminaChainButton* cb)
{
GdkPixbuf *pixbuf;
GdkPixbuf* pixbuf;
pixbuf = gdk_pixbuf_new_from_xpm_data(cb->chained ? vchain_xpm : vchain_broken_xpm);
gtk_image_set_from_pixbuf(GTK_IMAGE(cb->chain_image), pixbuf);
g_object_unref(pixbuf);
}
static void remmina_chain_button_on_clicked(GtkWidget *widget, RemminaChainButton *cb)
static void remmina_chain_button_on_clicked(GtkWidget* widget, RemminaChainButton* cb)
{
cb->chained = !cb->chained;
remmina_chain_button_update_chained(cb);
......@@ -161,11 +169,11 @@ static void remmina_chain_button_on_clicked(GtkWidget *widget, RemminaChainButto
g_signal_emit(G_OBJECT(cb), remmina_chain_button_signals[CHAIN_TOGGLED_SIGNAL], 0);
}
static void remmina_chain_button_init(RemminaChainButton *cb)
static void remmina_chain_button_init(RemminaChainButton* cb)
{
GtkWidget *widget;
GtkWidget *image;
GdkPixbuf *pixbuf;
GtkWidget* widget;
GtkWidget* image;
GdkPixbuf* pixbuf;
gtk_table_resize(GTK_TABLE(cb), 3, 1);
......@@ -201,7 +209,7 @@ remmina_chain_button_new(void)
return GTK_WIDGET(g_object_new(REMMINA_TYPE_CHAIN_BUTTON, NULL));
}
void remmina_chain_button_set(RemminaChainButton *cb, gboolean chained)
void remmina_chain_button_set(RemminaChainButton* cb, gboolean chained)
{
cb->chained = chained;
remmina_chain_button_update_chained(cb);
......
......@@ -36,21 +36,21 @@ typedef struct _RemminaChainButton
GtkTable table;
gboolean chained;
GtkWidget *chain_image;
GtkWidget* chain_image;
} RemminaChainButton;
typedef struct _RemminaChainButtonClass
{
GtkTableClass parent_class;
void (* chain_toggled) (RemminaChainButton *cb);
void (* chain_toggled) (RemminaChainButton* cb);
} RemminaChainButtonClass;
GType remmina_chain_button_get_type (void) G_GNUC_CONST;
GType remmina_chain_button_get_type(void) G_GNUC_CONST;
GtkWidget* remmina_chain_button_new (void);
GtkWidget* remmina_chain_button_new(void);
void remmina_chain_button_set (RemminaChainButton *cb, gboolean chained);