Verified Commit 4a10d64e authored by Zander Brown's avatar Zander Brown
Browse files

general: use int/double/float instead of gint etc

Usage of gint,gdouble,gfloat is discouraged in projects such as glib/gtk

In gtk4 all usage of gint/gdouble/gfloat has been dropped

Fix Librem5/phosh#364
parent fc3f7c63
......@@ -81,7 +81,7 @@ phosh_activity_set_property (GObject *object,
{
PhoshActivity *self = PHOSH_ACTIVITY (object);
PhoshActivityPrivate *priv = phosh_activity_get_instance_private(self);
gint height, width;
int height, width;
switch (property_id) {
case PROP_APP_ID:
......
......@@ -338,8 +338,8 @@ favorite_add_activated (GSimpleAction *action,
static void
long_pressed (GtkGestureLongPress *gesture,
gdouble x,
gdouble y,
double x,
double y,
GtkWidget *self)
{
context_menu (self, NULL);
......
......@@ -48,7 +48,7 @@ app_launched_cb (GtkWidget *widget,
}
static gint
static int
sort_apps (gconstpointer a,
gconstpointer b,
gpointer data)
......
......@@ -134,7 +134,7 @@ phosh_auth_finalize (GObject *object)
{
PhoshAuthPrivate *priv = phosh_auth_get_instance_private (PHOSH_AUTH(object));
GObjectClass *parent_class = G_OBJECT_CLASS (phosh_auth_parent_class);
gint ret;
int ret;
if (priv->pamh) {
ret = pam_end(priv->pamh, PAM_AUTH_ERR);
......
......@@ -181,10 +181,10 @@ pb_fill_color (int width, int height, GdkRGBA *color)
static GdkPixbuf *
pb_scale_to_fit (GdkPixbuf *src, int width, int height, GdkRGBA *color)
{
gint orig_width, orig_height;
gint final_width, final_height;
gint off_x, off_y;
gdouble ratio_horiz, ratio_vert, ratio;
int orig_width, orig_height;
int final_width, final_height;
int off_x, off_y;
double ratio_horiz, ratio_vert, ratio;
GdkPixbuf *bg;
bg = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
......@@ -258,7 +258,7 @@ image_background (GdkPixbuf *image,
static void
background_update (PhoshBackground *self, GdkPixbuf *pixbuf, GDesktopBackgroundStyle style)
{
gint width, height;
int width, height;
g_clear_object (&self->pixbuf);
......@@ -368,7 +368,7 @@ background_draw_cb (PhoshBackground *self,
cairo_t *cr,
gpointer data)
{
gint x = 0, y = 0;
int x = 0, y = 0;
g_return_val_if_fail (PHOSH_IS_BACKGROUND (self), TRUE);
......
......@@ -33,7 +33,7 @@ enum {
SIGNAL_LAST
};
static gint signals[SIGNAL_LAST];
static int signals[SIGNAL_LAST];
typedef struct {
GCancellable * cancellable;
......@@ -546,7 +546,7 @@ create_keyring_add_attr_list (NMConnection *connection,
typedef struct
{
/* Sort of ref count, indicates the number of secrets we still need to save */
gint n_secrets;
int n_secrets;
NMSecretAgentOld *self;
NMConnection *connection;
......
......@@ -54,7 +54,7 @@ struct _PhoshHome
GtkWidget *overview;
struct {
gdouble progress;
double progress;
gint64 last_frame;
} animation;
......@@ -105,9 +105,9 @@ phosh_home_get_property (GObject *object,
static void
phosh_home_resize (PhoshHome *self)
{
gint margin;
gint height;
gdouble progress = hdy_ease_out_cubic (self->animation.progress);
int margin;
int height;
double progress = hdy_ease_out_cubic (self->animation.progress);
if (self->state == PHOSH_HOME_STATE_UNFOLDED)
progress = 1.0 - progress;
......
......@@ -58,11 +58,11 @@ typedef struct {
guint anchor;
guint layer;
gboolean kbd_interactivity;
gint exclusive_zone;
gint margin_top, margin_bottom;
gint margin_left, margin_right;
gint width, height;
gint configured_width, configured_height;
int exclusive_zone;
int margin_top, margin_bottom;
int margin_left, margin_right;
int width, height;
int configured_width, configured_height;
char *namespace;
struct zwlr_layer_shell_v1 *layer_shell;
struct wl_output *wl_output;
......@@ -126,7 +126,7 @@ phosh_layer_surface_set_property (GObject *object,
{
PhoshLayerSurface *self = PHOSH_LAYER_SURFACE (object);
PhoshLayerSurfacePrivate *priv = phosh_layer_surface_get_instance_private (self);
gint width, height;
int width, height;
switch (property_id) {
case PHOSH_LAYER_SURFACE_PROP_LAYER_SHELL:
......@@ -591,10 +591,10 @@ phosh_layer_surface_get_wl_surface (PhoshLayerSurface *self)
* Set the size of a layer surface. A value of '-1' indicates 'use old value'
*/
void
phosh_layer_surface_set_size (PhoshLayerSurface *self, gint width, gint height)
phosh_layer_surface_set_size (PhoshLayerSurface *self, int width, int height)
{
PhoshLayerSurfacePrivate *priv;
gint old_width, old_height;
int old_width, old_height;
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
priv = phosh_layer_surface_get_instance_private (self);
......@@ -628,10 +628,10 @@ phosh_layer_surface_set_size (PhoshLayerSurface *self, gint width, gint height)
* Set anchor margins of a layer surface.
*/
void
phosh_layer_surface_set_margins (PhoshLayerSurface *self, gint top, gint right, gint bottom, gint left)
phosh_layer_surface_set_margins (PhoshLayerSurface *self, int top, int right, int bottom, int left)
{
PhoshLayerSurfacePrivate *priv;
gint old_top, old_bottom, old_left, old_right;
int old_top, old_bottom, old_left, old_right;
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
priv = phosh_layer_surface_get_instance_private (self);
......@@ -668,10 +668,10 @@ phosh_layer_surface_set_margins (PhoshLayerSurface *self, gint top, gint right,
* Set exclusive zone of a layer surface.
*/
void
phosh_layer_surface_set_exclusive_zone (PhoshLayerSurface *self, gint zone)
phosh_layer_surface_set_exclusive_zone (PhoshLayerSurface *self, int zone)
{
PhoshLayerSurfacePrivate *priv;
gint old_zone;
int old_zone;
g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
priv = phosh_layer_surface_get_instance_private (self);
......
......@@ -32,15 +32,15 @@ GtkWidget *phosh_layer_surface_new (gpointer layer_shell,
struct zwlr_layer_surface_v1 *phosh_layer_surface_get_layer_surface(PhoshLayerSurface *self);
struct wl_surface *phosh_layer_surface_get_wl_surface(PhoshLayerSurface *self);
void phosh_layer_surface_set_size(PhoshLayerSurface *self,
gint width,
gint height);
int width,
int height);
void phosh_layer_surface_set_margins(PhoshLayerSurface *self,
gint top,
gint right,
gint bottom,
gint left);
int top,
int right,
int bottom,
int left);
void phosh_layer_surface_set_exclusive_zone(PhoshLayerSurface *self,
gint zone);
int zone);
void phosh_layer_surface_set_kbd_interactivity(PhoshLayerSurface *self,
gboolean interactivity);
void phosh_layer_surface_wl_surface_commit (PhoshLayerSurface *self);
......@@ -52,10 +52,10 @@ typedef struct {
GPtrArray *shields; /* other outputs */
GSettings *settings;
gint timeout; /* timeout in seconds before screen locks */
int timeout; /* timeout in seconds before screen locks */
gboolean locked;
gint64 active_time; /* when lock was activated (in us) */
gint rotation; /* the shell rotation before locking */
int rotation; /* the shell rotation before locking */
} PhoshLockscreenManagerPrivate;
......@@ -381,7 +381,7 @@ phosh_lockscreen_manager_get_locked (PhoshLockscreenManager *self)
void
phosh_lockscreen_manager_set_timeout (PhoshLockscreenManager *self, gint timeout)
phosh_lockscreen_manager_set_timeout (PhoshLockscreenManager *self, int timeout)
{
PhoshLockscreenManagerPrivate *priv = phosh_lockscreen_manager_get_instance_private (self);
......@@ -396,7 +396,7 @@ phosh_lockscreen_manager_set_timeout (PhoshLockscreenManager *self, gint timeout
}
gint
int
phosh_lockscreen_manager_get_timeout (PhoshLockscreenManager *self)
{
PhoshLockscreenManagerPrivate *priv = phosh_lockscreen_manager_get_instance_private (self);
......
......@@ -21,6 +21,6 @@ void phosh_lockscreen_manager_set_locked (PhoshLockscreenMan
gboolean state);
gboolean phosh_lockscreen_manager_get_locked (PhoshLockscreenManager *self);
void phosh_lockscreen_manager_set_timeout (PhoshLockscreenManager *self,
gint timeout);
gint phosh_lockscreen_manager_get_timeout (PhoshLockscreenManager *self);
int timeout);
int phosh_lockscreen_manager_get_timeout (PhoshLockscreenManager *self);
gint64 phosh_lockscreen_manager_get_active_time (PhoshLockscreenManager *self);
......@@ -151,8 +151,8 @@ shake_label (GtkWidget *widget,
gint64 end_time = start_time + 1000 * 300;
gint64 now = gdk_frame_clock_get_frame_time (frame_clock);
gfloat t = (gfloat) (now - start_time) / (gfloat)(end_time - start_time);
gfloat pos = sin(t * 10) * 0.05 + 0.5;
float t = (float) (now - start_time) / (float) (end_time - start_time);
float pos = sin (t * 10) * 0.05 + 0.5;
if (now > end_time) {
/* Stop the animation only when we would step over the idle position (0.5) */
......@@ -217,8 +217,8 @@ delete_button_clicked_cb (PhoshLockscreen *self,
static void
long_press_del_cb (PhoshLockscreen *self,
gdouble x,
gdouble y,
double x,
double y,
GtkGesture *gesture)
{
g_return_if_fail (PHOSH_IS_LOCKSCREEN (self));
......
......@@ -136,7 +136,7 @@ phosh_monitor_manager_handle_get_resources (
g_variant_builder_add (&output_builder, "(uxiausauaua{sv})",
(guint32)i, /* ID */
(guint64)i, /* output->winsys_id, */
(gint)i, /* crtc_index, */
(int) i, /* crtc_index, */
&crtcs,
monitor->name, /* output->name */
&modes,
......@@ -186,7 +186,7 @@ phosh_monitor_manager_handle_change_backlight (
GDBusMethodInvocation *invocation,
guint serial,
guint output_index,
gint value)
int value)
{
g_debug ("Unimplemented DBus call %s", __func__);
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
......@@ -707,7 +707,7 @@ power_save_mode_changed_cb (PhoshMonitorManager *self,
GParamSpec *pspec,
gpointer user_data)
{
gint mode, ps_mode;
int mode, ps_mode;
mode = phosh_display_dbus_display_config_get_power_save_mode (
PHOSH_DISPLAY_DBUS_DISPLAY_CONFIG (self));
......
......@@ -39,8 +39,8 @@ typedef enum _PhoshMonitorConnectorType
typedef struct _PhoshMonitorMode
{
gint width, height;
gint refresh;
int width, height;
int refresh;
guint32 flags;
} PhoshMonitorMode;
......@@ -66,16 +66,16 @@ struct _PhoshMonitor {
struct zwlr_output_power_v1 *wlr_output_power;
PhoshMonitorPowerSaveMode power_mode;
gint x, y, width, height;
gint subpixel;
int x, y, width, height;
int subpixel;
gint32 transform, scale;
struct {
gint32 x, y, width, height;
} logical;
gint width_mm;
gint height_mm;
int width_mm;
int height_mm;
char *vendor;
char *product;
......
......@@ -204,7 +204,7 @@ network_prompt_setup_dialog (PhoshNetworkAuthPrompt *self)
self->security_type == NMU_SEC_WPA2_PSK)
password = nm_setting_wireless_security_get_psk (wireless_setting);
else if (self->security_type == NMU_SEC_STATIC_WEP) {
gint index;
int index;
index = nm_setting_wireless_security_get_wep_tx_keyidx (wireless_setting);
password = nm_setting_wireless_security_get_wep_key (wireless_setting, index);
......
......@@ -39,7 +39,7 @@ struct _PhoshNotificationBanner {
gulong handler_closed;
struct {
gdouble progress;
double progress;
gint64 last_frame;
} animation;
};
......@@ -163,9 +163,9 @@ phosh_notification_banner_finalize (GObject *object)
static void
phosh_notification_banner_slide (PhoshNotificationBanner *self)
{
gint margin;
gint height;
gdouble progress = hdy_ease_out_cubic (self->animation.progress);
int margin;
int height;
double progress = hdy_ease_out_cubic (self->animation.progress);
progress = 1.0 - progress;
......
......@@ -278,7 +278,7 @@ handle_notify (PhoshNotifyDbusNotifications *skeleton,
const char *body,
const char *const *actions,
GVariant *hints,
gint expire_timeout)
int expire_timeout)
{
PhoshNotifyManager *self = PHOSH_NOTIFY_MANAGER (skeleton);
PhoshNotification *notification = NULL;
......
......@@ -171,7 +171,7 @@ request_thumbnail (PhoshActivity *activity, PhoshToplevel *toplevel)
{
PhoshToplevelThumbnail *thumbnail;
GtkAllocation allocation;
gint scale;
int scale;
g_return_if_fail (PHOSH_IS_ACTIVITY (activity));
g_return_if_fail (PHOSH_IS_TOPLEVEL (toplevel));
scale = gtk_widget_get_scale_factor (GTK_WIDGET (activity));
......
......@@ -416,7 +416,7 @@ void
phosh_panel_fold (PhoshPanel *self)
{
PhoshPanelPrivate *priv;
gint width;
int width;
g_return_if_fail (PHOSH_IS_PANEL (self));
priv = phosh_panel_get_instance_private (self);
......
......@@ -144,7 +144,7 @@ auth_request_initiate (AuthRequest *request)
for (l = request->identities; l != NULL; l = l->next) {
if (POLKIT_IS_UNIX_USER (l->data)) {
PolkitUnixUser *user = POLKIT_UNIX_USER (l->data);
gint uid;
int uid;
char buf[4096];
struct passwd pwd;
struct passwd *ppwd;
......
......@@ -149,7 +149,7 @@ set_user_names (PhoshPolkitAuthPrompt *self, const GStrv user_names)
{
const char *user_name = NULL;
GError *err = NULL;
gint len;
int len;
g_return_if_fail (PHOSH_IS_POLKIT_AUTH_PROMPT (self));
......
......@@ -150,10 +150,10 @@ battery_setting_clicked_cb (PhoshSettings *self)
}
static void change_volume (PhoshSettings *self,
gint steps)
int steps)
{
GtkAdjustment *adj;
gdouble vol, inc;
double vol, inc;
adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (self->output_vol_bar)));
......@@ -290,7 +290,7 @@ static void
vol_adjustment_value_changed_cb (GtkAdjustment *adjustment,
PhoshSettings *self)
{
gdouble volume, rounded;
double volume, rounded;
g_autofree char *name = NULL;
if (!self->output_stream)
......
......@@ -25,7 +25,7 @@ brightness_changed_cb (GDBusProxy *proxy,
gpointer *user_data)
{
GtkScale *scale = GTK_SCALE (user_data);
gint value;
int value;
gboolean ret;
if (setting_brightness)
......@@ -47,7 +47,7 @@ brightness_init_cb (GObject *source_object,
{
g_autoptr(GError) err = NULL;
GVariant *var;
gint value;
int value;
brightness_proxy = g_dbus_proxy_new_finish (res, &err);
if (!brightness_proxy || err) {
......
......@@ -190,7 +190,7 @@ on_scale_button_release_event (GtkWidget *widget,
GvcChannelBar *self)
{
GtkAdjustment *adj;
gdouble value;
double value;
self->click_lock = FALSE;
......@@ -211,9 +211,9 @@ gboolean
gvc_channel_bar_scroll (GvcChannelBar *self, GdkEventScroll *event)
{
GtkAdjustment *adj;
gdouble value;
double value;
GdkScrollDirection direction;
gdouble dx, dy;
double dx, dy;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (GVC_IS_CHANNEL_BAR (self), FALSE);
......@@ -273,7 +273,7 @@ gvc_channel_bar_scroll (GvcChannelBar *self, GdkEventScroll *event)
value = value + dy * SCROLLSTEP;
}
gvc_channel_bar_set_is_muted (self, ((gint)value == 0));
gvc_channel_bar_set_is_muted (self, ((int) value == 0));
adj = gtk_range_get_adjustment (GTK_RANGE (self->scale));
gtk_adjustment_set_value (adj, value);
......@@ -294,7 +294,7 @@ static void
on_zero_adjustment_value_changed (GtkAdjustment *adjustment,
GvcChannelBar *self)
{
gdouble value;
double value;
if (self->click_lock != FALSE) {
return;
......
......@@ -103,7 +103,7 @@ typedef struct
PhoshProximity *proximity;
gboolean startup_finished;
gint rot; /* current rotation of primary monitor */
int rot; /* current rotation of primary monitor */
} PhoshShellPrivate;
......@@ -638,7 +638,7 @@ phosh_shell_init (PhoshShell *self)
}
gint
int
phosh_shell_get_rotation (PhoshShell *self)
{
PhoshShellPrivate *priv;
......@@ -892,12 +892,12 @@ phosh_shell_get_wwan (PhoshShell *self)
* display
*/
void
phosh_shell_get_usable_area (PhoshShell *self, gint *x, gint *y, gint *width, gint *height)
phosh_shell_get_usable_area (PhoshShell *self, int *x, int *y, int *width, int *height)
{
PhoshMonitor *monitor;
PhoshMonitorMode *mode;
gint w, h;
gint scale;
int w, h;
int scale;
g_return_if_fail (PHOSH_IS_SHELL (self));
......
......@@ -33,10 +33,10 @@ PhoshShell *phosh_shell_get_default (void);
void phosh_shell_rotate_display (PhoshShell *self, guint degrees);
int phosh_shell_get_rotation (PhoshShell *self);
void phosh_shell_get_usable_area (PhoshShell *self,
gint *x,
gint *y,
gint *width,
gint *height);
int *x,
int *y,
int *width,
int *height);
void phosh_shell_set_locked (PhoshShell *self, gboolean locked);
gboolean phosh_shell_get_locked (PhoshShell *self);
void phosh_shell_lock (PhoshShell *self);
......
......@@ -442,7 +442,7 @@ on_password_changed (PhoshSystemPrompt *self,
PhoshSystemPromptPrivate *priv;
int upper, lower, digit, misc;
const char *password;
gdouble pwstrength;
double pwstrength;
int length, i;
g_return_if_fail (PHOSH_IS_SYSTEM_PROMPT (self));
......
......@@ -28,7 +28,7 @@ char *
phosh_fix_app_id (const char *app_id)
{
if (strchr (app_id, '.') == NULL && !g_ascii_isupper (app_id[0])) {
gint first_char = 0;
int first_char = 0;
if (g_str_has_prefix (app_id, "gnome-")) {
first_char = strlen ("gnome-");
}
......
......@@ -180,7 +180,7 @@ static void
phosh_wwan_mm_update_lock_status (PhoshWWanMM *self)
{
guint unlock_required;
gint state;
int state;
g_return_if_fail (self);
g_return_if_fail (self->proxy);
......
......@@ -19,7 +19,7 @@ phosh_shell_get_default (void)
}
void
phosh_shell_get_usable_area (PhoshShell *self, gint *x, gint *y, gint *width, gint *height)
phosh_shell_get_usable_area (PhoshShell *self, int *x, int *y, int *width, int *height)
{
if (x)
*x = 16;
......
......@@ -19,8 +19,8 @@ test_phosh_activity_new(void)
}
gint
main (gint argc,
int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
......
......@@ -216,8 +216,8 @@ test_phosh_app_grid_button_is_favorite (void)
}
gint
main (gint argc,
int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
......
......@@ -38,8 +38,8 @@ test_phosh_app_list_model_g_list_iface (void)
}
gint
main (gint argc,
int
main (int argc,
char *argv[])
{
g_test_init (&argc, &argv, NULL);
......