[refactor] code intent and rename teleport_app_window to teleport_window
This commit is contained in:
@@ -34,7 +34,7 @@ static GActionEntry app_entries[] =
|
|||||||
{ "open-file", open_file_callback, "as", NULL, NULL }
|
{ "open-file", open_file_callback, "as", NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static TeleportAppWindow *win;
|
static TeleportWindow *win;
|
||||||
static GApplication *application;
|
static GApplication *application;
|
||||||
static gint signalIds [N_SIGNALS];
|
static gint signalIds [N_SIGNALS];
|
||||||
|
|
||||||
@@ -136,11 +136,11 @@ teleport_app_init (TeleportApp *app) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
teleport_app_activate (GApplication *app) {
|
teleport_app_activate (GApplication *app) {
|
||||||
//TeleportAppWindow *win;
|
//TeleportWindow *win;
|
||||||
TeleportPeer *peerList = g_object_new (TELEPORT_TYPE_PEER, NULL);
|
TeleportPeer *peerList = g_object_new (TELEPORT_TYPE_PEER, NULL);
|
||||||
application = app;
|
application = app;
|
||||||
|
|
||||||
win = teleport_app_window_new (TELEPORT_APP (app));
|
win = teleport_window_new (TELEPORT_APP (app));
|
||||||
gtk_window_present (GTK_WINDOW (win));
|
gtk_window_present (GTK_WINDOW (win));
|
||||||
|
|
||||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||||
@@ -184,12 +184,12 @@ teleport_app_open (GApplication *app,
|
|||||||
|
|
||||||
windows = gtk_application_get_windows (GTK_APPLICATION (app));
|
windows = gtk_application_get_windows (GTK_APPLICATION (app));
|
||||||
if (windows)
|
if (windows)
|
||||||
win = TELEPORT_APP_WINDOW (windows->data);
|
win = TELEPORT_WINDOW (windows->data);
|
||||||
else
|
else
|
||||||
win = teleport_app_window_new (TELEPORT_APP (app));
|
win = teleport_window_new (TELEPORT_APP (app));
|
||||||
|
|
||||||
for (i = 0; i < n_files; i++)
|
for (i = 0; i < n_files; i++)
|
||||||
teleport_app_window_open (win, files[i]);
|
teleport_window_open (win, files[i]);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (win));
|
gtk_window_present (GTK_WINDOW (win));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,16 @@
|
|||||||
#include "teleport-peer.h"
|
#include "teleport-peer.h"
|
||||||
|
|
||||||
GtkWidget *find_child(GtkWidget *, const gchar *);
|
GtkWidget *find_child(GtkWidget *, const gchar *);
|
||||||
TeleportAppWindow *mainWin;
|
TeleportWindow *mainWin;
|
||||||
|
|
||||||
struct _TeleportAppWindow
|
struct _TeleportWindow
|
||||||
{
|
{
|
||||||
GtkApplicationWindow parent;
|
GtkApplicationWindow parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _TeleportAppWindowPrivate TeleportAppWindowPrivate;
|
typedef struct _TeleportWindowPrivate TeleportWindowPrivate;
|
||||||
|
|
||||||
struct _TeleportAppWindowPrivate
|
struct _TeleportWindowPrivate
|
||||||
{
|
{
|
||||||
GSettings *settings;
|
GSettings *settings;
|
||||||
GtkWidget *gears;
|
GtkWidget *gears;
|
||||||
@@ -24,18 +24,18 @@ struct _TeleportAppWindowPrivate
|
|||||||
GtkWidget *remote_no_devices;
|
GtkWidget *remote_no_devices;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE(TeleportAppWindow, teleport_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
G_DEFINE_TYPE_WITH_PRIVATE(TeleportWindow, teleport_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
teleport_app_window_init (TeleportAppWindow *win)
|
teleport_window_init (TeleportWindow *win)
|
||||||
{
|
{
|
||||||
TeleportAppWindowPrivate *priv;
|
TeleportWindowPrivate *priv;
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
GtkEntry *downloadDir;
|
GtkEntry *downloadDir;
|
||||||
mainWin = win;
|
mainWin = win;
|
||||||
|
|
||||||
priv = teleport_app_window_get_instance_private (win);
|
priv = teleport_window_get_instance_private (win);
|
||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (win));
|
gtk_widget_init_template (GTK_WIDGET (win));
|
||||||
|
|
||||||
@@ -55,7 +55,8 @@ teleport_app_window_init (TeleportAppWindow *win)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
open_file_picker(GtkButton *btn, Peer *device) {
|
open_file_picker(GtkButton *btn,
|
||||||
|
Peer *device) {
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||||
gint res;
|
gint res;
|
||||||
@@ -87,15 +88,18 @@ open_file_picker(GtkButton *btn, Peer *device) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_remote_device_list(TeleportAppWindow *win, Peer *device) {
|
void
|
||||||
TeleportAppWindowPrivate *priv;
|
update_remote_device_list(TeleportWindow *win,
|
||||||
|
Peer *device)
|
||||||
|
{
|
||||||
|
TeleportWindowPrivate *priv;
|
||||||
GtkBuilder *builder_remote_list;
|
GtkBuilder *builder_remote_list;
|
||||||
GtkWidget *row;
|
GtkWidget *row;
|
||||||
GtkLabel *name_label;
|
GtkLabel *name_label;
|
||||||
GtkButton *send_btn;
|
GtkButton *send_btn;
|
||||||
//GtkWidget *line;
|
//GtkWidget *line;
|
||||||
|
|
||||||
priv = teleport_app_window_get_instance_private (win);
|
priv = teleport_window_get_instance_private (win);
|
||||||
|
|
||||||
gtk_widget_hide (priv->remote_no_devices);
|
gtk_widget_hide (priv->remote_no_devices);
|
||||||
|
|
||||||
@@ -114,14 +118,17 @@ void update_remote_device_list(TeleportAppWindow *win, Peer *device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void update_remote_device_list_remove(TeleportAppWindow *win, Peer *device) {
|
void
|
||||||
TeleportAppWindowPrivate *priv;
|
update_remote_device_list_remove(TeleportWindow *win,
|
||||||
|
Peer *device)
|
||||||
|
{
|
||||||
|
TeleportWindowPrivate *priv;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
GtkListBoxRow *remote_row;
|
GtkListBoxRow *remote_row;
|
||||||
GtkLabel *name_label;
|
GtkLabel *name_label;
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
|
||||||
priv = teleport_app_window_get_instance_private (win);
|
priv = teleport_window_get_instance_private (win);
|
||||||
box = priv->remote_devices_list;
|
box = priv->remote_devices_list;
|
||||||
|
|
||||||
remote_row = gtk_list_box_get_row_at_index (GTK_LIST_BOX(box), i);
|
remote_row = gtk_list_box_get_row_at_index (GTK_LIST_BOX(box), i);
|
||||||
@@ -167,43 +174,43 @@ find_child(GtkWidget *parent, const gchar *name)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
teleport_app_window_dispose (GObject *object)
|
teleport_window_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
//TeleportAppWindow *win;
|
//TeleportWindow *win;
|
||||||
//TeleportAppWindowPrivate *priv;
|
//TeleportWindowPrivate *priv;
|
||||||
|
|
||||||
//win = TELEPORT_APP_WINDOW (object);
|
//win = TELEPORT_WINDOW (object);
|
||||||
//priv = teleport_app_window_get_instance_private (win);
|
//priv = teleport_window_get_instance_private (win);
|
||||||
|
|
||||||
//g_clear_object (&priv->settings);
|
//g_clear_object (&priv->settings);
|
||||||
|
|
||||||
G_OBJECT_CLASS (teleport_app_window_parent_class)->dispose (object);
|
G_OBJECT_CLASS (teleport_window_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
teleport_app_window_class_init (TeleportAppWindowClass *class)
|
teleport_window_class_init (TeleportWindowClass *class)
|
||||||
{
|
{
|
||||||
G_OBJECT_CLASS (class)->dispose = teleport_app_window_dispose;
|
G_OBJECT_CLASS (class)->dispose = teleport_window_dispose;
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||||
"/com/frac_tion/teleport/window.ui");
|
"/com/frac_tion/teleport/window.ui");
|
||||||
|
|
||||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, gears);
|
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, gears);
|
||||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, this_device_name_label);
|
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, this_device_name_label);
|
||||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, remote_no_devices);
|
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, remote_no_devices);
|
||||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportAppWindow, remote_devices_list);
|
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, remote_devices_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
TeleportAppWindow *
|
TeleportWindow *
|
||||||
teleport_app_window_new (TeleportApp *app)
|
teleport_window_new (TeleportApp *app)
|
||||||
{
|
{
|
||||||
return g_object_new (TELEPORT_APP_WINDOW_TYPE, "application", app, NULL);
|
return g_object_new (TELEPORT_WINDOW_TYPE, "application", app, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
teleport_app_window_open (TeleportAppWindow *win,
|
teleport_window_open (TeleportWindow *win,
|
||||||
GFile *file)
|
GFile *file)
|
||||||
{
|
{
|
||||||
//TeleportAppWindowPrivate *priv;
|
//TeleportWindowPrivate *priv;
|
||||||
//priv = teleport_app_window_get_instance_private (win);
|
//priv = teleport_window_get_instance_private (win);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,19 +5,19 @@
|
|||||||
#include "teleport-app.h"
|
#include "teleport-app.h"
|
||||||
#include "teleport-peer.h"
|
#include "teleport-peer.h"
|
||||||
|
|
||||||
#define TELEPORT_APP_WINDOW_TYPE (teleport_app_window_get_type ())
|
#define TELEPORT_WINDOW_TYPE (teleport_window_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (TeleportAppWindow,
|
G_DECLARE_FINAL_TYPE (TeleportWindow,
|
||||||
teleport_app_window,
|
teleport_window,
|
||||||
TELEPORT,
|
TELEPORT,
|
||||||
APP_WINDOW,
|
WINDOW,
|
||||||
GtkApplicationWindow)
|
GtkApplicationWindow)
|
||||||
|
|
||||||
TeleportAppWindow *teleport_app_window_new (TeleportApp *app);
|
TeleportWindow *teleport_window_new (TeleportApp *);
|
||||||
void teleport_app_window_open (TeleportAppWindow *win,
|
void teleport_window_open (TeleportWindow *,
|
||||||
GFile *file);
|
GFile *);
|
||||||
void update_remote_device_list (TeleportAppWindow *,
|
void update_remote_device_list (TeleportWindow *,
|
||||||
Peer *);
|
Peer *);
|
||||||
void update_remote_device_list_remove (TeleportAppWindow *,
|
void update_remote_device_list_remove (TeleportWindow *,
|
||||||
Peer *);
|
Peer *);
|
||||||
|
|
||||||
#endif /* __TELEPORT_WINDOW_H */
|
#endif /* __TELEPORT_WINDOW_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user