network: no more cell renderers
Now that the list has been converted to a listbox, we don't need any of these anymore.
This commit is contained in:
parent
71dad5e98b
commit
d0f0e8c99c
14 changed files with 8 additions and 1145 deletions
|
@ -35,18 +35,6 @@ libnetwork_la_SOURCES = \
|
|||
net-vpn.h \
|
||||
net-proxy.c \
|
||||
net-proxy.h \
|
||||
panel-cell-renderer-mode.c \
|
||||
panel-cell-renderer-mode.h \
|
||||
panel-cell-renderer-security.c \
|
||||
panel-cell-renderer-security.h \
|
||||
panel-cell-renderer-signal.c \
|
||||
panel-cell-renderer-signal.h \
|
||||
panel-cell-renderer-separator.c \
|
||||
panel-cell-renderer-separator.h \
|
||||
panel-cell-renderer-text.c \
|
||||
panel-cell-renderer-text.h \
|
||||
panel-cell-renderer-pixbuf.c \
|
||||
panel-cell-renderer-pixbuf.h \
|
||||
network-dialogs.c \
|
||||
network-dialogs.h \
|
||||
cc-network-panel.c \
|
||||
|
|
|
@ -38,12 +38,6 @@
|
|||
|
||||
#include "network-dialogs.h"
|
||||
#include "panel-common.h"
|
||||
#include "panel-cell-renderer-mode.h"
|
||||
#include "panel-cell-renderer-signal.h"
|
||||
#include "panel-cell-renderer-security.h"
|
||||
#include "panel-cell-renderer-separator.h"
|
||||
#include "panel-cell-renderer-text.h"
|
||||
#include "panel-cell-renderer-pixbuf.h"
|
||||
|
||||
#include "egg-list-box/egg-list-box.h"
|
||||
|
||||
|
@ -51,6 +45,14 @@
|
|||
|
||||
#define NET_DEVICE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_WIFI, NetDeviceWifiPrivate))
|
||||
|
||||
typedef enum {
|
||||
NM_AP_SEC_UNKNOWN,
|
||||
NM_AP_SEC_NONE,
|
||||
NM_AP_SEC_WEP,
|
||||
NM_AP_SEC_WPA,
|
||||
NM_AP_SEC_WPA2
|
||||
} NMAccessPointSecurity;
|
||||
|
||||
static void nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi);
|
||||
static void show_wifi_list (NetDeviceWifi *device_wifi);
|
||||
static void populate_ap_list (NetDeviceWifi *device_wifi);
|
||||
|
|
|
@ -1,144 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "panel-cell-renderer-mode.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_AP_MODE,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (PanelCellRendererMode, panel_cell_renderer_mode, GTK_TYPE_CELL_RENDERER_PIXBUF)
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_mode_get_property:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_mode_get_property (GObject *object, guint param_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_AP_MODE:
|
||||
g_value_set_uint (value, renderer->mode);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_set_name:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_set_name (PanelCellRendererMode *renderer)
|
||||
{
|
||||
const gchar *icon_name = NULL;
|
||||
|
||||
if (renderer->mode == NM_802_11_MODE_ADHOC)
|
||||
icon_name = "network-workgroup-symbolic";
|
||||
|
||||
g_object_set (renderer, "icon-name", icon_name, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_mode_set_property:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_mode_set_property (GObject *object, guint param_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_AP_MODE:
|
||||
renderer->mode = g_value_get_uint (value);
|
||||
panel_cell_renderer_set_name (renderer);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_finalize:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_finalize (GObject *object)
|
||||
{
|
||||
PanelCellRendererMode *renderer;
|
||||
renderer = PANEL_CELL_RENDERER_MODE (object);
|
||||
g_free (renderer->icon_name);
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_mode_class_init:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_mode_class_init (PanelCellRendererModeClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
object_class->finalize = panel_cell_renderer_finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
object_class->get_property = panel_cell_renderer_mode_get_property;
|
||||
object_class->set_property = panel_cell_renderer_mode_set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_AP_MODE,
|
||||
g_param_spec_uint ("ap-mode", NULL,
|
||||
NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_mode_init:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_mode_init (PanelCellRendererMode *renderer)
|
||||
{
|
||||
renderer->mode = 0;
|
||||
renderer->icon_name = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_mode_new:
|
||||
**/
|
||||
GtkCellRenderer *
|
||||
panel_cell_renderer_mode_new (void)
|
||||
{
|
||||
return g_object_new (PANEL_TYPE_CELL_RENDERER_MODE, NULL);
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef PANEL_CELL_RENDERER_MODE_H
|
||||
#define PANEL_CELL_RENDERER_MODE_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "nm-device.h"
|
||||
#include "nm-access-point.h"
|
||||
|
||||
#define PANEL_TYPE_CELL_RENDERER_MODE (panel_cell_renderer_mode_get_type())
|
||||
#define PANEL_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererMode))
|
||||
#define PANEL_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
|
||||
#define PANEL_IS_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_MODE))
|
||||
#define PANEL_IS_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_MODE))
|
||||
#define PANEL_CELL_RENDERER_MODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PanelCellRendererMode PanelCellRendererMode;
|
||||
typedef struct _PanelCellRendererModeClass PanelCellRendererModeClass;
|
||||
|
||||
struct _PanelCellRendererMode
|
||||
{
|
||||
GtkCellRendererPixbuf parent;
|
||||
guint mode;
|
||||
gchar *icon_name;
|
||||
};
|
||||
|
||||
struct _PanelCellRendererModeClass
|
||||
{
|
||||
GtkCellRendererPixbufClass parent_class;
|
||||
};
|
||||
|
||||
GType panel_cell_renderer_mode_get_type (void);
|
||||
GtkCellRenderer *panel_cell_renderer_mode_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* PANEL_CELL_RENDERER_MODE_H */
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* -*- Pixbuf: C; tab-width: 8; indent-tabs-pixbuf: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Written by Matthias Clasen
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "panel-cell-renderer-pixbuf.h"
|
||||
|
||||
enum {
|
||||
ACTIVATE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (PanelCellRendererPixbuf, panel_cell_renderer_pixbuf, GTK_TYPE_CELL_RENDERER_PIXBUF)
|
||||
|
||||
static gint
|
||||
activate (GtkCellRenderer *cell,
|
||||
GdkEvent *event,
|
||||
GtkWidget *widget,
|
||||
const gchar *path,
|
||||
const GdkRectangle *background_area,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
g_signal_emit (cell, signals[ACTIVATE], 0, path);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
panel_cell_renderer_pixbuf_class_init (PanelCellRendererPixbufClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkCellRendererClass *cell_renderer_class = GTK_CELL_RENDERER_CLASS (class);
|
||||
|
||||
cell_renderer_class->activate = activate;
|
||||
|
||||
signals[ACTIVATE] =
|
||||
g_signal_new ("activate",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PanelCellRendererPixbufClass, activate),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
}
|
||||
|
||||
static void
|
||||
panel_cell_renderer_pixbuf_init (PanelCellRendererPixbuf *renderer)
|
||||
{
|
||||
}
|
||||
|
||||
GtkCellRenderer *
|
||||
panel_cell_renderer_pixbuf_new (void)
|
||||
{
|
||||
return g_object_new (PANEL_TYPE_CELL_RENDERER_PIXBUF, NULL);
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Pixbuf: C; tab-width: 8; indent-tabs-pixbuf: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Written by Matthias Clasen
|
||||
*/
|
||||
|
||||
#ifndef PANEL_CELL_RENDERER_PIXBUF_H
|
||||
#define PANEL_CELL_RENDERER_PIXBUF_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PANEL_TYPE_CELL_RENDERER_PIXBUF (panel_cell_renderer_pixbuf_get_type())
|
||||
#define PANEL_CELL_RENDERER_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_PIXBUF, PanelCellRendererPixbuf))
|
||||
#define PANEL_CELL_RENDERER_PIXBUF_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_PIXBUF, PanelCellRendererPixbufClass))
|
||||
#define PANEL_IS_CELL_RENDERER_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_PIXBUF))
|
||||
#define PANEL_IS_CELL_RENDERER_PIXBUF_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_PIXBUF))
|
||||
#define PANEL_CELL_RENDERER_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_PIXBUF, PanelCellRendererPixbufClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PanelCellRendererPixbuf PanelCellRendererPixbuf;
|
||||
typedef struct _PanelCellRendererPixbufClass PanelCellRendererPixbufClass;
|
||||
|
||||
struct _PanelCellRendererPixbuf
|
||||
{
|
||||
GtkCellRendererPixbuf parent;
|
||||
};
|
||||
|
||||
struct _PanelCellRendererPixbufClass
|
||||
{
|
||||
GtkCellRendererPixbufClass parent_class;
|
||||
|
||||
void (*activate) (PanelCellRendererPixbuf *pixbuf,
|
||||
const gchar *path);
|
||||
};
|
||||
|
||||
GType panel_cell_renderer_pixbuf_get_type (void);
|
||||
GtkCellRenderer *panel_cell_renderer_pixbuf_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* PANEL_CELL_RENDERER_PIXBUF_H */
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
/* -*- Security: C; tab-width: 8; indent-tabs-security: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "panel-cell-renderer-security.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_SECURITY,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (PanelCellRendererSecurity, panel_cell_renderer_security, GTK_TYPE_CELL_RENDERER_PIXBUF)
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_security_get_property:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_security_get_property (GObject *object, guint param_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererSecurity *renderer = PANEL_CELL_RENDERER_SECURITY (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_SECURITY:
|
||||
g_value_set_uint (value, renderer->security);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_set_name:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_set_name (PanelCellRendererSecurity *renderer)
|
||||
{
|
||||
const gchar *icon_name = NULL;
|
||||
|
||||
if (renderer->security != NM_AP_SEC_UNKNOWN &&
|
||||
renderer->security != NM_AP_SEC_NONE)
|
||||
icon_name = "network-wireless-encrypted-symbolic";
|
||||
|
||||
if (icon_name != NULL) {
|
||||
g_object_set (renderer,
|
||||
"icon-name", icon_name,
|
||||
NULL);
|
||||
} else {
|
||||
g_object_set (renderer,
|
||||
"icon-name", "",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_security_set_property:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_security_set_property (GObject *object, guint param_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererSecurity *renderer = PANEL_CELL_RENDERER_SECURITY (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_SECURITY:
|
||||
renderer->security = g_value_get_uint (value);
|
||||
panel_cell_renderer_set_name (renderer);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_finalize:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_finalize (GObject *object)
|
||||
{
|
||||
PanelCellRendererSecurity *renderer;
|
||||
renderer = PANEL_CELL_RENDERER_SECURITY (object);
|
||||
g_free (renderer->icon_name);
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_security_class_init:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_security_class_init (PanelCellRendererSecurityClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
object_class->finalize = panel_cell_renderer_finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
object_class->get_property = panel_cell_renderer_security_get_property;
|
||||
object_class->set_property = panel_cell_renderer_security_set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_SECURITY,
|
||||
g_param_spec_uint ("security", NULL,
|
||||
NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_security_init:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_security_init (PanelCellRendererSecurity *renderer)
|
||||
{
|
||||
renderer->security = 0;
|
||||
renderer->icon_name = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_security_new:
|
||||
**/
|
||||
GtkCellRenderer *
|
||||
panel_cell_renderer_security_new (void)
|
||||
{
|
||||
return g_object_new (PANEL_TYPE_CELL_RENDERER_SECURITY, NULL);
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/* -*- Security: C; tab-width: 8; indent-tabs-security: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef PANEL_CELL_RENDERER_SECURITY_H
|
||||
#define PANEL_CELL_RENDERER_SECURITY_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "nm-device.h"
|
||||
#include "nm-access-point.h"
|
||||
|
||||
#define PANEL_TYPE_CELL_RENDERER_SECURITY (panel_cell_renderer_security_get_type())
|
||||
#define PANEL_CELL_RENDERER_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_SECURITY, PanelCellRendererSecurity))
|
||||
#define PANEL_CELL_RENDERER_SECURITY_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_SECURITY, PanelCellRendererSecurityClass))
|
||||
#define PANEL_IS_CELL_RENDERER_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_SECURITY))
|
||||
#define PANEL_IS_CELL_RENDERER_SECURITY_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_SECURITY))
|
||||
#define PANEL_CELL_RENDERER_SECURITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_SECURITY, PanelCellRendererSecurityClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PanelCellRendererSecurity PanelCellRendererSecurity;
|
||||
typedef struct _PanelCellRendererSecurityClass PanelCellRendererSecurityClass;
|
||||
|
||||
typedef enum {
|
||||
NM_AP_SEC_UNKNOWN,
|
||||
NM_AP_SEC_NONE,
|
||||
NM_AP_SEC_WEP,
|
||||
NM_AP_SEC_WPA,
|
||||
NM_AP_SEC_WPA2
|
||||
} NMAccessPointSecurity;
|
||||
|
||||
struct _PanelCellRendererSecurity
|
||||
{
|
||||
GtkCellRendererPixbuf parent;
|
||||
guint security;
|
||||
gchar *icon_name;
|
||||
};
|
||||
|
||||
struct _PanelCellRendererSecurityClass
|
||||
{
|
||||
GtkCellRendererPixbufClass parent_class;
|
||||
};
|
||||
|
||||
GType panel_cell_renderer_security_get_type (void);
|
||||
GtkCellRenderer *panel_cell_renderer_security_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* PANEL_CELL_RENDERER_SECURITY_H */
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
/* -*- Separator: C; tab-width: 8; indent-tabs-separator: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Written by Matthias Clasen
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "panel-cell-renderer-separator.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DRAW,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (PanelCellRendererSeparator, panel_cell_renderer_separator, GTK_TYPE_CELL_RENDERER)
|
||||
|
||||
static void
|
||||
panel_cell_renderer_separator_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererSeparator *renderer = PANEL_CELL_RENDERER_SEPARATOR (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_DRAW:
|
||||
g_value_set_boolean (value, renderer->draw);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
panel_cell_renderer_separator_set_property (GObject *object,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererSeparator *renderer = PANEL_CELL_RENDERER_SEPARATOR (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_DRAW:
|
||||
renderer->draw = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
render (GtkCellRenderer *cell,
|
||||
cairo_t *cr,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *background_area,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
PanelCellRendererSeparator *renderer = PANEL_CELL_RENDERER_SEPARATOR (cell);
|
||||
GtkStyleContext *context;
|
||||
gint x, y, w, h, xpad, ypad;
|
||||
|
||||
if (!renderer->draw)
|
||||
return;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
x = cell_area->x + xpad;
|
||||
y = cell_area->y + ypad;
|
||||
w = cell_area->width - xpad * 2;
|
||||
h = cell_area->height - ypad * 2;
|
||||
|
||||
gtk_render_line (context, cr, x + w / 2, y, x + w / 2, y + h - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
panel_cell_renderer_separator_class_init (PanelCellRendererSeparatorClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkCellRendererClass *cell_renderer_class = GTK_CELL_RENDERER_CLASS (class);
|
||||
|
||||
object_class->get_property = panel_cell_renderer_separator_get_property;
|
||||
object_class->set_property = panel_cell_renderer_separator_set_property;
|
||||
|
||||
cell_renderer_class->render = render;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_DRAW,
|
||||
g_param_spec_boolean ("draw", "draw", "draw",
|
||||
TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
panel_cell_renderer_separator_init (PanelCellRendererSeparator *renderer)
|
||||
{
|
||||
renderer->draw = TRUE;
|
||||
}
|
||||
|
||||
GtkCellRenderer *
|
||||
panel_cell_renderer_separator_new (void)
|
||||
{
|
||||
return g_object_new (PANEL_TYPE_CELL_RENDERER_SEPARATOR, NULL);
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/* -*- Separator: C; tab-width: 8; indent-tabs-separator: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Written by Matthias Clasen
|
||||
*/
|
||||
|
||||
#ifndef PANEL_CELL_RENDERER_SEPARATOR_H
|
||||
#define PANEL_CELL_RENDERER_SEPARATOR_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "nm-device.h"
|
||||
#include "nm-access-point.h"
|
||||
|
||||
#define PANEL_TYPE_CELL_RENDERER_SEPARATOR (panel_cell_renderer_separator_get_type())
|
||||
#define PANEL_CELL_RENDERER_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_SEPARATOR, PanelCellRendererSeparator))
|
||||
#define PANEL_CELL_RENDERER_SEPARATOR_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_SEPARATOR, PanelCellRendererSeparatorClass))
|
||||
#define PANEL_IS_CELL_RENDERER_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_SEPARATOR))
|
||||
#define PANEL_IS_CELL_RENDERER_SEPARATOR_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_SEPARATOR))
|
||||
#define PANEL_CELL_RENDERER_SEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_SEPARATOR, PanelCellRendererSeparatorClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PanelCellRendererSeparator PanelCellRendererSeparator;
|
||||
typedef struct _PanelCellRendererSeparatorClass PanelCellRendererSeparatorClass;
|
||||
|
||||
struct _PanelCellRendererSeparator
|
||||
{
|
||||
GtkCellRenderer parent;
|
||||
gboolean draw;
|
||||
};
|
||||
|
||||
struct _PanelCellRendererSeparatorClass
|
||||
{
|
||||
GtkCellRendererClass parent_class;
|
||||
};
|
||||
|
||||
GType panel_cell_renderer_separator_get_type (void);
|
||||
GtkCellRenderer *panel_cell_renderer_separator_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* PANEL_CELL_RENDERER_SEPARATOR_H */
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-signal: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "panel-cell-renderer-signal.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_SIGNAL,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (PanelCellRendererSignal, panel_cell_renderer_signal, GTK_TYPE_CELL_RENDERER_PIXBUF)
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_signal_get_property:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_signal_get_property (GObject *object, guint param_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_SIGNAL:
|
||||
g_value_set_uint (value, renderer->signal);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_set_name:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_set_name (PanelCellRendererSignal *renderer)
|
||||
{
|
||||
const gchar *icon_name = NULL;
|
||||
GIcon *icon;
|
||||
|
||||
/* the 'Other...' entry */
|
||||
if (renderer->signal <= 0) {
|
||||
g_object_set (renderer, "gicon", NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (renderer->signal < 20)
|
||||
icon_name = "network-wireless-signal-none-symbolic";
|
||||
else if (renderer->signal < 40)
|
||||
icon_name = "network-wireless-signal-weak-symbolic";
|
||||
else if (renderer->signal < 50)
|
||||
icon_name = "network-wireless-signal-ok-symbolic";
|
||||
else if (renderer->signal < 80)
|
||||
icon_name = "network-wireless-signal-good-symbolic";
|
||||
else
|
||||
icon_name = "network-wireless-signal-excellent-symbolic";
|
||||
|
||||
icon = g_themed_icon_new_with_default_fallbacks (icon_name);
|
||||
g_object_set (renderer, "gicon", icon, NULL);
|
||||
g_object_unref (icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_signal_set_property:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_signal_set_property (GObject *object, guint param_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
|
||||
|
||||
switch (param_id) {
|
||||
case PROP_SIGNAL:
|
||||
renderer->signal = g_value_get_uint (value);
|
||||
panel_cell_renderer_set_name (renderer);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_finalize:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_finalize (GObject *object)
|
||||
{
|
||||
PanelCellRendererSignal *renderer;
|
||||
renderer = PANEL_CELL_RENDERER_SIGNAL (object);
|
||||
g_free (renderer->icon_name);
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_signal_class_init:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_signal_class_init (PanelCellRendererSignalClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
object_class->finalize = panel_cell_renderer_finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
object_class->get_property = panel_cell_renderer_signal_get_property;
|
||||
object_class->set_property = panel_cell_renderer_signal_set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_SIGNAL,
|
||||
g_param_spec_uint ("signal", NULL,
|
||||
NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_signal_init:
|
||||
**/
|
||||
static void
|
||||
panel_cell_renderer_signal_init (PanelCellRendererSignal *renderer)
|
||||
{
|
||||
renderer->signal = 0;
|
||||
renderer->icon_name = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_cell_renderer_signal_new:
|
||||
**/
|
||||
GtkCellRenderer *
|
||||
panel_cell_renderer_signal_new (void)
|
||||
{
|
||||
return g_object_new (PANEL_TYPE_CELL_RENDERER_SIGNAL, NULL);
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-signal: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef PANEL_CELL_RENDERER_SIGNAL_H
|
||||
#define PANEL_CELL_RENDERER_SIGNAL_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "nm-device.h"
|
||||
#include "nm-access-point.h"
|
||||
|
||||
#define PANEL_TYPE_CELL_RENDERER_SIGNAL (panel_cell_renderer_signal_get_type())
|
||||
#define PANEL_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignal))
|
||||
#define PANEL_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
|
||||
#define PANEL_IS_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL))
|
||||
#define PANEL_IS_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL))
|
||||
#define PANEL_CELL_RENDERER_SIGNAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PanelCellRendererSignal PanelCellRendererSignal;
|
||||
typedef struct _PanelCellRendererSignalClass PanelCellRendererSignalClass;
|
||||
|
||||
struct _PanelCellRendererSignal
|
||||
{
|
||||
GtkCellRendererPixbuf parent;
|
||||
guint signal;
|
||||
gchar *icon_name;
|
||||
};
|
||||
|
||||
struct _PanelCellRendererSignalClass
|
||||
{
|
||||
GtkCellRendererPixbufClass parent_class;
|
||||
};
|
||||
|
||||
GType panel_cell_renderer_signal_get_type (void);
|
||||
GtkCellRenderer *panel_cell_renderer_signal_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* PANEL_CELL_RENDERER_SIGNAL_H */
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* -*- Text: C; tab-width: 8; indent-tabs-text: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Written by Matthias Clasen
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "panel-cell-renderer-text.h"
|
||||
|
||||
enum {
|
||||
ACTIVATE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (PanelCellRendererText, panel_cell_renderer_text, GTK_TYPE_CELL_RENDERER_TEXT)
|
||||
|
||||
static gint
|
||||
activate (GtkCellRenderer *cell,
|
||||
GdkEvent *event,
|
||||
GtkWidget *widget,
|
||||
const gchar *path,
|
||||
const GdkRectangle *background_area,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
g_signal_emit (cell, signals[ACTIVATE], 0, path);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
panel_cell_renderer_text_class_init (PanelCellRendererTextClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkCellRendererClass *cell_renderer_class = GTK_CELL_RENDERER_CLASS (class);
|
||||
|
||||
cell_renderer_class->activate = activate;
|
||||
|
||||
signals[ACTIVATE] =
|
||||
g_signal_new ("activate",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PanelCellRendererTextClass, activate),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
}
|
||||
|
||||
static void
|
||||
panel_cell_renderer_text_init (PanelCellRendererText *renderer)
|
||||
{
|
||||
}
|
||||
|
||||
GtkCellRenderer *
|
||||
panel_cell_renderer_text_new (void)
|
||||
{
|
||||
return g_object_new (PANEL_TYPE_CELL_RENDERER_TEXT, NULL);
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Text: C; tab-width: 8; indent-tabs-text: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Written by Matthias Clasen
|
||||
*/
|
||||
|
||||
#ifndef PANEL_CELL_RENDERER_TEXT_H
|
||||
#define PANEL_CELL_RENDERER_TEXT_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PANEL_TYPE_CELL_RENDERER_TEXT (panel_cell_renderer_text_get_type())
|
||||
#define PANEL_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_TEXT, PanelCellRendererText))
|
||||
#define PANEL_CELL_RENDERER_TEXT_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_TEXT, PanelCellRendererTextClass))
|
||||
#define PANEL_IS_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_TEXT))
|
||||
#define PANEL_IS_CELL_RENDERER_TEXT_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_TEXT))
|
||||
#define PANEL_CELL_RENDERER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_TEXT, PanelCellRendererTextClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PanelCellRendererText PanelCellRendererText;
|
||||
typedef struct _PanelCellRendererTextClass PanelCellRendererTextClass;
|
||||
|
||||
struct _PanelCellRendererText
|
||||
{
|
||||
GtkCellRendererText parent;
|
||||
};
|
||||
|
||||
struct _PanelCellRendererTextClass
|
||||
{
|
||||
GtkCellRendererTextClass parent_class;
|
||||
|
||||
void (*activate) (PanelCellRendererText *text,
|
||||
const gchar *path);
|
||||
};
|
||||
|
||||
GType panel_cell_renderer_text_get_type (void);
|
||||
GtkCellRenderer *panel_cell_renderer_text_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* PANEL_CELL_RENDERER_TEXT_H */
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue