[style] fix intentation and spaces befor and after *

This commit is contained in:
Julian Sparber
2017-09-03 14:21:59 +02:00
parent 2415da9284
commit 1530816fab
2 changed files with 37 additions and 39 deletions

View File

@@ -23,51 +23,51 @@ struct _TeleportApp
G_DEFINE_TYPE(TeleportApp, teleport_app, GTK_TYPE_APPLICATION);
static void create_user_notification (const char *file_name, const int file_size, const char * origin_device)
static void create_user_notification (const char *file_name, const int file_size, const char *origin_device)
{
GNotification *notification = g_notification_new ("Teleport");
g_notification_set_body (notification, g_strdup_printf("%s is sending %s (%d Byte)", origin_device, file_name, file_size));
GIcon *icon = g_themed_icon_new ("dialog-information");
g_notification_set_icon (notification, icon);
g_notification_add_button (notification, "Decline", "app.reply-5-minutes");
g_notification_add_button (notification, "Save", "app.reply-5-minutes");
g_application_send_notification (application, NULL, notification);
g_object_unref (icon);
g_object_unref (notification);
GNotification *notification = g_notification_new ("Teleport");
g_notification_set_body (notification, g_strdup_printf("%s is sending %s (%d Byte)", origin_device, file_name, file_size));
GIcon *icon = g_themed_icon_new ("dialog-information");
g_notification_set_icon (notification, icon);
g_notification_add_button (notification, "Decline", "app.reply-5-minutes");
g_notification_add_button (notification, "Save", "app.reply-5-minutes");
g_application_send_notification (application, NULL, notification);
g_object_unref (icon);
g_object_unref (notification);
}
static void create_finished_notification (const char *file_name, const int file_size, const char * origin_device)
static void create_finished_notification (const char *file_name, const int file_size, const char *origin_device)
{
GNotification *notification = g_notification_new ("Teleport");
g_notification_set_body (notification, g_strdup_printf("Transfer %s from %s is complete)", file_name, origin_device));
GIcon *icon = g_themed_icon_new ("dialog-information");
g_notification_set_icon (notification, icon);
g_notification_add_button (notification, "Open", "app.reply-5-minutes");
g_application_send_notification (application, NULL, notification);
g_object_unref (icon);
g_object_unref (notification);
GNotification *notification = g_notification_new ("Teleport");
g_notification_set_body (notification, g_strdup_printf("Transfer %s from %s is complete)", file_name, origin_device));
GIcon *icon = g_themed_icon_new ("dialog-information");
g_notification_set_icon (notification, icon);
g_notification_add_button (notification, "Open", "app.reply-5-minutes");
g_application_send_notification (application, NULL, notification);
g_object_unref (icon);
g_object_unref (notification);
}
gboolean mainLoopAddPeerCallback (gpointer name) {
update_remote_device_list(win, (char*)name);
update_remote_device_list(win, (char *)name);
return G_SOURCE_REMOVE;
}
gboolean mainLoopRemovePeerCallback (gpointer name) {
update_remote_device_list_remove(win, (char*)name);
update_remote_device_list_remove(win, (char *)name);
return G_SOURCE_REMOVE;
}
void callback_add_peer(GObject * instance, char * name, TeleportAppWindow * win ) {
void callback_add_peer(GObject *instance, char *name, TeleportAppWindow *win ) {
g_idle_add(mainLoopAddPeerCallback, g_strdup(name));
}
void callback_remove_peer(GObject * instance, char * name, TeleportAppWindow * win ) {
void callback_remove_peer(GObject *instance, char *name, TeleportAppWindow *win ) {
g_idle_add(mainLoopRemovePeerCallback, g_strdup(name));
}
void callback_notify_user(GObject * instance, char * name, TeleportAppWindow * win ) {
void callback_notify_user(GObject *instance, char *name, TeleportAppWindow *win ) {
create_user_notification("icon.png", 2000, "Mark's laptop");
}
@@ -90,10 +90,10 @@ teleport_app_activate (GApplication *app)
g_signal_connect (peerList, "removepeer", (GCallback)callback_remove_peer, win);
g_signal_connect (app, "notify_user", (GCallback)callback_notify_user, win);
/*teleport_peer_add_peer(peerList, "julian", "192.168.0.1", 3000);
g_print("Data: %s\n", teleport_peer_get_name(peerList, 0, NULL));
g_print("Data: %s\n", teleport_peer_get_ip(peerList, 0, NULL));
g_print("Data: %d\n", teleport_peer_get_port(peerList, 0, NULL));
*/
g_print("Data: %s\n", teleport_peer_get_name(peerList, 0, NULL));
g_print("Data: %s\n", teleport_peer_get_ip(peerList, 0, NULL));
g_print("Data: %d\n", teleport_peer_get_port(peerList, 0, NULL));
*/
run_http_server();
run_avahi_publish_service("Angela's (self)");
run_avahi_service(peerList);
@@ -149,5 +149,3 @@ teleport_app_new (void)
"flags", G_APPLICATION_HANDLES_OPEN,
NULL);
}

View File

@@ -5,8 +5,8 @@
#include "server.h"
GtkWidget* find_child(GtkWidget* , const gchar* );
TeleportAppWindow* mainWin;
GtkWidget *find_child(GtkWidget *, const gchar *);
TeleportAppWindow *mainWin;
struct _TeleportAppWindow
{
@@ -45,7 +45,7 @@ teleport_app_window_init (TeleportAppWindow *win)
}
static void
open_file_picker(GtkButton * btn, GString* deviceName) {
open_file_picker(GtkButton *btn, GString *deviceName) {
GtkWidget *dialog;
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
gint res;
@@ -75,7 +75,7 @@ open_file_picker(GtkButton * btn, GString* deviceName) {
gtk_widget_destroy (dialog);
}
void update_remote_device_list(TeleportAppWindow *win, char * name) {
void update_remote_device_list(TeleportAppWindow *win, char *name) {
TeleportAppWindowPrivate *priv;
GtkBuilder *builder_remote_list;
GtkWidget *row;
@@ -100,7 +100,7 @@ void update_remote_device_list(TeleportAppWindow *win, char * name) {
}
void update_remote_device_list_remove(TeleportAppWindow *win, char * name) {
void update_remote_device_list_remove(TeleportAppWindow *win, char *name) {
TeleportAppWindowPrivate *priv;
GtkWidget *box;
GtkListBoxRow *remote_row;
@@ -123,10 +123,10 @@ void update_remote_device_list_remove(TeleportAppWindow *win, char * name) {
}
}
GtkWidget*
find_child(GtkWidget* parent, const gchar* name)
GtkWidget *
find_child(GtkWidget *parent, const gchar *name)
{
if (g_strcmp0(gtk_widget_get_name((GtkWidget*)parent), (gchar*)name) == 0) {
if (g_strcmp0(gtk_widget_get_name((GtkWidget *)parent), (gchar *)name) == 0) {
return parent;
}
@@ -138,7 +138,7 @@ find_child(GtkWidget* parent, const gchar* name)
if (GTK_IS_CONTAINER(parent)) {
GList *children = gtk_container_get_children(GTK_CONTAINER(parent));
while ((children = g_list_next(children)) != NULL) {
GtkWidget* widget = find_child(children->data, name);
GtkWidget *widget = find_child(children->data, name);
if (widget != NULL) {
return widget;
}