[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 }
|
||||
};
|
||||
|
||||
static TeleportAppWindow *win;
|
||||
static TeleportWindow *win;
|
||||
static GApplication *application;
|
||||
static gint signalIds [N_SIGNALS];
|
||||
|
||||
@@ -136,11 +136,11 @@ teleport_app_init (TeleportApp *app) {
|
||||
|
||||
static void
|
||||
teleport_app_activate (GApplication *app) {
|
||||
//TeleportAppWindow *win;
|
||||
//TeleportWindow *win;
|
||||
TeleportPeer *peerList = g_object_new (TELEPORT_TYPE_PEER, NULL);
|
||||
application = app;
|
||||
|
||||
win = teleport_app_window_new (TELEPORT_APP (app));
|
||||
win = teleport_window_new (TELEPORT_APP (app));
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
|
||||
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));
|
||||
if (windows)
|
||||
win = TELEPORT_APP_WINDOW (windows->data);
|
||||
win = TELEPORT_WINDOW (windows->data);
|
||||
else
|
||||
win = teleport_app_window_new (TELEPORT_APP (app));
|
||||
win = teleport_window_new (TELEPORT_APP (app));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
#include "teleport-peer.h"
|
||||
|
||||
GtkWidget *find_child(GtkWidget *, const gchar *);
|
||||
TeleportAppWindow *mainWin;
|
||||
TeleportWindow *mainWin;
|
||||
|
||||
struct _TeleportAppWindow
|
||||
struct _TeleportWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct _TeleportAppWindowPrivate TeleportAppWindowPrivate;
|
||||
typedef struct _TeleportWindowPrivate TeleportWindowPrivate;
|
||||
|
||||
struct _TeleportAppWindowPrivate
|
||||
struct _TeleportWindowPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *gears;
|
||||
@@ -24,18 +24,18 @@ struct _TeleportAppWindowPrivate
|
||||
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
|
||||
teleport_app_window_init (TeleportAppWindow *win)
|
||||
teleport_window_init (TeleportWindow *win)
|
||||
{
|
||||
TeleportAppWindowPrivate *priv;
|
||||
TeleportWindowPrivate *priv;
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *menu;
|
||||
GtkEntry *downloadDir;
|
||||
mainWin = win;
|
||||
|
||||
priv = teleport_app_window_get_instance_private (win);
|
||||
priv = teleport_window_get_instance_private (win);
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
@@ -55,7 +55,8 @@ teleport_app_window_init (TeleportAppWindow *win)
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_picker(GtkButton *btn, Peer *device) {
|
||||
open_file_picker(GtkButton *btn,
|
||||
Peer *device) {
|
||||
GtkWidget *dialog;
|
||||
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||
gint res;
|
||||
@@ -87,15 +88,18 @@ open_file_picker(GtkButton *btn, Peer *device) {
|
||||
}
|
||||
}
|
||||
|
||||
void update_remote_device_list(TeleportAppWindow *win, Peer *device) {
|
||||
TeleportAppWindowPrivate *priv;
|
||||
void
|
||||
update_remote_device_list(TeleportWindow *win,
|
||||
Peer *device)
|
||||
{
|
||||
TeleportWindowPrivate *priv;
|
||||
GtkBuilder *builder_remote_list;
|
||||
GtkWidget *row;
|
||||
GtkLabel *name_label;
|
||||
GtkButton *send_btn;
|
||||
//GtkWidget *line;
|
||||
|
||||
priv = teleport_app_window_get_instance_private (win);
|
||||
priv = teleport_window_get_instance_private (win);
|
||||
|
||||
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) {
|
||||
TeleportAppWindowPrivate *priv;
|
||||
void
|
||||
update_remote_device_list_remove(TeleportWindow *win,
|
||||
Peer *device)
|
||||
{
|
||||
TeleportWindowPrivate *priv;
|
||||
GtkWidget *box;
|
||||
GtkListBoxRow *remote_row;
|
||||
GtkLabel *name_label;
|
||||
gint i = 0;
|
||||
|
||||
priv = teleport_app_window_get_instance_private (win);
|
||||
priv = teleport_window_get_instance_private (win);
|
||||
box = priv->remote_devices_list;
|
||||
|
||||
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
|
||||
teleport_app_window_dispose (GObject *object)
|
||||
teleport_window_dispose (GObject *object)
|
||||
{
|
||||
//TeleportAppWindow *win;
|
||||
//TeleportAppWindowPrivate *priv;
|
||||
//TeleportWindow *win;
|
||||
//TeleportWindowPrivate *priv;
|
||||
|
||||
//win = TELEPORT_APP_WINDOW (object);
|
||||
//priv = teleport_app_window_get_instance_private (win);
|
||||
//win = TELEPORT_WINDOW (object);
|
||||
//priv = teleport_window_get_instance_private (win);
|
||||
|
||||
//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
|
||||
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),
|
||||
"/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), TeleportAppWindow, 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), TeleportAppWindow, remote_devices_list);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, gears);
|
||||
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), TeleportWindow, remote_no_devices);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, remote_devices_list);
|
||||
}
|
||||
|
||||
TeleportAppWindow *
|
||||
teleport_app_window_new (TeleportApp *app)
|
||||
TeleportWindow *
|
||||
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
|
||||
teleport_app_window_open (TeleportAppWindow *win,
|
||||
GFile *file)
|
||||
teleport_window_open (TeleportWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
//TeleportAppWindowPrivate *priv;
|
||||
//priv = teleport_app_window_get_instance_private (win);
|
||||
//TeleportWindowPrivate *priv;
|
||||
//priv = teleport_window_get_instance_private (win);
|
||||
}
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
#include "teleport-app.h"
|
||||
#include "teleport-peer.h"
|
||||
|
||||
#define TELEPORT_APP_WINDOW_TYPE (teleport_app_window_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (TeleportAppWindow,
|
||||
teleport_app_window,
|
||||
#define TELEPORT_WINDOW_TYPE (teleport_window_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (TeleportWindow,
|
||||
teleport_window,
|
||||
TELEPORT,
|
||||
APP_WINDOW,
|
||||
WINDOW,
|
||||
GtkApplicationWindow)
|
||||
|
||||
TeleportAppWindow *teleport_app_window_new (TeleportApp *app);
|
||||
void teleport_app_window_open (TeleportAppWindow *win,
|
||||
GFile *file);
|
||||
void update_remote_device_list (TeleportAppWindow *,
|
||||
TeleportWindow *teleport_window_new (TeleportApp *);
|
||||
void teleport_window_open (TeleportWindow *,
|
||||
GFile *);
|
||||
void update_remote_device_list (TeleportWindow *,
|
||||
Peer *);
|
||||
void update_remote_device_list_remove (TeleportAppWindow *,
|
||||
void update_remote_device_list_remove (TeleportWindow *,
|
||||
Peer *);
|
||||
|
||||
#endif /* __TELEPORT_WINDOW_H */
|
||||
|
||||
Reference in New Issue
Block a user